@ionic/react 7.5.3-dev.11698856380.18896dcd → 7.5.3-dev.11698858201.14165f23

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 (247) hide show
  1. package/dist/components/CreateAnimation.js +107 -0
  2. package/dist/components/CreateAnimation.js.map +7 -0
  3. package/dist/components/IonActionSheet.js +8 -0
  4. package/dist/components/IonActionSheet.js.map +7 -0
  5. package/dist/components/IonAlert.js +8 -0
  6. package/dist/components/IonAlert.js.map +7 -0
  7. package/dist/components/IonApp.js +42 -0
  8. package/dist/components/IonApp.js.map +7 -0
  9. package/dist/components/IonIcon.js +39 -0
  10. package/dist/components/IonIcon.js.map +7 -0
  11. package/dist/components/IonLoading.js +8 -0
  12. package/dist/components/IonLoading.js.map +7 -0
  13. package/dist/components/IonModal.js +9 -0
  14. package/dist/components/IonModal.js.map +7 -0
  15. package/dist/components/IonOverlayManager.js +29 -0
  16. package/dist/components/IonOverlayManager.js.map +7 -0
  17. package/dist/components/IonPage.js +31 -0
  18. package/dist/components/IonPage.js.map +7 -0
  19. package/dist/components/IonPicker.js +8 -0
  20. package/dist/components/IonPicker.js.map +7 -0
  21. package/dist/components/IonPopover.js +8 -0
  22. package/dist/components/IonPopover.js.map +7 -0
  23. package/dist/components/IonRedirect.js +19 -0
  24. package/dist/components/IonRedirect.js.map +7 -0
  25. package/dist/components/IonRoute.js +17 -0
  26. package/dist/components/IonRoute.js.map +7 -0
  27. package/dist/components/IonRouterContext.js +32 -0
  28. package/dist/components/IonRouterContext.js.map +7 -0
  29. package/dist/components/IonRouterOutlet.js +24 -0
  30. package/dist/components/IonRouterOutlet.js.map +7 -0
  31. package/dist/components/IonToast.js +8 -0
  32. package/dist/components/IonToast.js.map +7 -0
  33. package/dist/components/IonicReactProps.js +2 -0
  34. package/dist/components/IonicReactProps.js.map +7 -0
  35. package/dist/components/__tests__/utils.spec.js +50 -0
  36. package/dist/components/__tests__/utils.spec.js.map +7 -0
  37. package/dist/components/createControllerComponent.js +80 -0
  38. package/dist/components/createControllerComponent.js.map +7 -0
  39. package/dist/components/createInlineOverlayComponent.js +114 -0
  40. package/dist/components/createInlineOverlayComponent.js.map +7 -0
  41. package/dist/components/createOverlayComponent.js +88 -0
  42. package/dist/components/createOverlayComponent.js.map +7 -0
  43. package/dist/components/createRoutingComponent.js +79 -0
  44. package/dist/components/createRoutingComponent.js.map +7 -0
  45. package/dist/components/hrefprops.js +2 -0
  46. package/dist/components/hrefprops.js.map +7 -0
  47. package/dist/components/index.js +126 -0
  48. package/dist/components/index.js.map +7 -0
  49. package/dist/components/inner-proxies.js +30 -0
  50. package/dist/components/inner-proxies.js.map +7 -0
  51. package/dist/components/navigation/IonBackButton.js +31 -0
  52. package/dist/components/navigation/IonBackButton.js.map +7 -0
  53. package/dist/components/navigation/IonNav.js +21 -0
  54. package/dist/components/navigation/IonNav.js.map +7 -0
  55. package/dist/components/navigation/IonTabBar.js +173 -0
  56. package/dist/components/navigation/IonTabBar.js.map +7 -0
  57. package/dist/components/navigation/IonTabButton.js +30 -0
  58. package/dist/components/navigation/IonTabButton.js.map +7 -0
  59. package/dist/components/navigation/IonTabs.js +103 -0
  60. package/dist/components/navigation/IonTabs.js.map +7 -0
  61. package/dist/components/navigation/IonTabsContext.js +7 -0
  62. package/dist/components/navigation/IonTabsContext.js.map +7 -0
  63. package/dist/components/proxies.js +131 -0
  64. package/dist/components/proxies.js.map +7 -0
  65. package/dist/components/react-component-lib/createComponent.js +58 -0
  66. package/dist/components/react-component-lib/createComponent.js.map +7 -0
  67. package/dist/components/react-component-lib/createOverlayComponent.js +86 -0
  68. package/dist/components/react-component-lib/createOverlayComponent.js.map +7 -0
  69. package/dist/components/react-component-lib/index.js +4 -0
  70. package/dist/components/react-component-lib/index.js.map +7 -0
  71. package/dist/components/react-component-lib/interfaces.js +2 -0
  72. package/dist/components/react-component-lib/interfaces.js.map +7 -0
  73. package/dist/components/react-component-lib/utils/attachProps.js +92 -0
  74. package/dist/components/react-component-lib/utils/attachProps.js.map +7 -0
  75. package/dist/components/react-component-lib/utils/case.js +4 -0
  76. package/dist/components/react-component-lib/utils/case.js.map +7 -0
  77. package/dist/components/react-component-lib/utils/dev.js +14 -0
  78. package/dist/components/react-component-lib/utils/dev.js.map +7 -0
  79. package/dist/components/react-component-lib/utils/index.js +31 -0
  80. package/dist/components/react-component-lib/utils/index.js.map +7 -0
  81. package/dist/components/routing-proxies.js +29 -0
  82. package/dist/components/routing-proxies.js.map +7 -0
  83. package/dist/components/utils/detachProps.js +24 -0
  84. package/dist/components/utils/detachProps.js.map +7 -0
  85. package/dist/components/utils/index.js +26 -0
  86. package/dist/components/utils/index.js.map +7 -0
  87. package/dist/components/utils/ionRenderToString.js +36 -0
  88. package/dist/components/utils/ionRenderToString.js.map +7 -0
  89. package/dist/contexts/IonContext.js +11 -0
  90. package/dist/contexts/IonContext.js.map +7 -0
  91. package/dist/contexts/IonLifeCycleContext.js +185 -0
  92. package/dist/contexts/IonLifeCycleContext.js.map +7 -0
  93. package/dist/contexts/NavContext.js +36 -0
  94. package/dist/contexts/NavContext.js.map +7 -0
  95. package/dist/framework-delegate.js +30 -0
  96. package/dist/framework-delegate.js.map +7 -0
  97. package/dist/hooks/HookOverlayOptions.js +2 -0
  98. package/dist/hooks/HookOverlayOptions.js.map +7 -0
  99. package/dist/hooks/__tests__/hooks.spec.js +6 -0
  100. package/dist/hooks/__tests__/hooks.spec.js.map +7 -0
  101. package/dist/hooks/useController.js +45 -0
  102. package/dist/hooks/useController.js.map +7 -0
  103. package/dist/hooks/useIonActionSheet.js +27 -0
  104. package/dist/hooks/useIonActionSheet.js.map +7 -0
  105. package/dist/hooks/useIonAlert.js +23 -0
  106. package/dist/hooks/useIonAlert.js.map +7 -0
  107. package/dist/hooks/useIonLoading.js +28 -0
  108. package/dist/hooks/useIonLoading.js.map +7 -0
  109. package/dist/hooks/useIonModal.js +22 -0
  110. package/dist/hooks/useIonModal.js.map +7 -0
  111. package/dist/hooks/useIonPicker.js +27 -0
  112. package/dist/hooks/useIonPicker.js.map +7 -0
  113. package/dist/hooks/useIonPopover.js +22 -0
  114. package/dist/hooks/useIonPopover.js.map +7 -0
  115. package/dist/hooks/useIonToast.js +23 -0
  116. package/dist/hooks/useIonToast.js.map +7 -0
  117. package/dist/hooks/useOverlay.js +67 -0
  118. package/dist/hooks/useOverlay.js.map +7 -0
  119. package/dist/index.js +8 -2443
  120. package/dist/index.js.map +7 -1
  121. package/dist/lifecycle/IonLifeCycleHOC.js +41 -0
  122. package/dist/lifecycle/IonLifeCycleHOC.js.map +7 -0
  123. package/dist/lifecycle/hooks.js +52 -0
  124. package/dist/lifecycle/hooks.js.map +7 -0
  125. package/dist/lifecycle/index.js +4 -0
  126. package/dist/lifecycle/index.js.map +7 -0
  127. package/dist/models/ReactComponentOrElement.js +2 -0
  128. package/dist/models/ReactComponentOrElement.js.map +7 -0
  129. package/dist/models/RouteAction.js +2 -0
  130. package/dist/models/RouteAction.js.map +7 -0
  131. package/dist/models/RouteInfo.js +2 -0
  132. package/dist/models/RouteInfo.js.map +7 -0
  133. package/dist/models/RouterDirection.js +2 -0
  134. package/dist/models/RouterDirection.js.map +7 -0
  135. package/dist/models/RouterOptions.js +2 -0
  136. package/dist/models/RouterOptions.js.map +7 -0
  137. package/dist/models/index.js +7 -0
  138. package/dist/models/index.js.map +7 -0
  139. package/dist/routing/LocationHistory.js +140 -0
  140. package/dist/routing/LocationHistory.js.map +7 -0
  141. package/dist/routing/NavManager.js +76 -0
  142. package/dist/routing/NavManager.js.map +7 -0
  143. package/dist/routing/OutletPageManager.js +69 -0
  144. package/dist/routing/OutletPageManager.js.map +7 -0
  145. package/dist/routing/PageManager.js +60 -0
  146. package/dist/routing/PageManager.js.map +7 -0
  147. package/dist/routing/RouteManagerContext.js +15 -0
  148. package/dist/routing/RouteManagerContext.js.map +7 -0
  149. package/dist/routing/StackContext.js +7 -0
  150. package/dist/routing/StackContext.js.map +7 -0
  151. package/dist/routing/ViewItem.js +2 -0
  152. package/dist/routing/ViewItem.js.map +7 -0
  153. package/dist/routing/ViewLifeCycleManager.js +36 -0
  154. package/dist/routing/ViewLifeCycleManager.js.map +7 -0
  155. package/dist/routing/ViewStacks.js +49 -0
  156. package/dist/routing/ViewStacks.js.map +7 -0
  157. package/dist/routing/__tests__/LocationHistory.spec.js +185 -0
  158. package/dist/routing/__tests__/LocationHistory.spec.js.map +7 -0
  159. package/dist/routing/index.js +9 -0
  160. package/dist/routing/index.js.map +7 -0
  161. package/dist/utils/HTMLElementSSR.js +4 -0
  162. package/dist/utils/HTMLElementSSR.js.map +7 -0
  163. package/dist/utils/generateId.js +8 -0
  164. package/dist/utils/generateId.js.map +7 -0
  165. package/package.json +5 -12
  166. package/dist/types/components/CreateAnimation.d.ts +0 -71
  167. package/dist/types/components/IonActionSheet.d.ts +0 -3
  168. package/dist/types/components/IonAlert.d.ts +0 -3
  169. package/dist/types/components/IonApp.d.ts +0 -41
  170. package/dist/types/components/IonIcon.d.ts +0 -16
  171. package/dist/types/components/IonLoading.d.ts +0 -3
  172. package/dist/types/components/IonModal.d.ts +0 -3
  173. package/dist/types/components/IonOverlayManager.d.ts +0 -15
  174. package/dist/types/components/IonPage.d.ts +0 -3
  175. package/dist/types/components/IonPicker.d.ts +0 -3
  176. package/dist/types/components/IonPopover.d.ts +0 -3
  177. package/dist/types/components/IonRedirect.d.ts +0 -16
  178. package/dist/types/components/IonRoute.d.ts +0 -17
  179. package/dist/types/components/IonRouterContext.d.ts +0 -42
  180. package/dist/types/components/IonRouterOutlet.d.ts +0 -8
  181. package/dist/types/components/IonToast.d.ts +0 -3
  182. package/dist/types/components/IonicReactProps.d.ts +0 -6
  183. package/dist/types/components/__tests__/utils.spec.d.ts +0 -1
  184. package/dist/types/components/createControllerComponent.d.ts +0 -19
  185. package/dist/types/components/createInlineOverlayComponent.d.ts +0 -2
  186. package/dist/types/components/createOverlayComponent.d.ts +0 -20
  187. package/dist/types/components/createRoutingComponent.d.ts +0 -2
  188. package/dist/types/components/hrefprops.d.ts +0 -9
  189. package/dist/types/components/index.d.ts +0 -35
  190. package/dist/types/components/inner-proxies.d.ts +0 -14
  191. package/dist/types/components/navigation/IonBackButton.d.ts +0 -68
  192. package/dist/types/components/navigation/IonNav.d.ts +0 -5
  193. package/dist/types/components/navigation/IonTabBar.d.ts +0 -15
  194. package/dist/types/components/navigation/IonTabButton.d.ts +0 -40
  195. package/dist/types/components/navigation/IonTabs.d.ts +0 -49
  196. package/dist/types/components/navigation/IonTabsContext.d.ts +0 -6
  197. package/dist/types/components/proxies.d.ts +0 -66
  198. package/dist/types/components/react-component-lib/createComponent.d.ts +0 -10
  199. package/dist/types/components/react-component-lib/createOverlayComponent.d.ts +0 -21
  200. package/dist/types/components/react-component-lib/index.d.ts +0 -2
  201. package/dist/types/components/react-component-lib/interfaces.d.ts +0 -29
  202. package/dist/types/components/react-component-lib/utils/attachProps.d.ts +0 -16
  203. package/dist/types/components/react-component-lib/utils/case.d.ts +0 -2
  204. package/dist/types/components/react-component-lib/utils/dev.d.ts +0 -2
  205. package/dist/types/components/react-component-lib/utils/index.d.ts +0 -10
  206. package/dist/types/components/routing-proxies.d.ts +0 -44
  207. package/dist/types/components/utils/detachProps.d.ts +0 -8
  208. package/dist/types/components/utils/index.d.ts +0 -8
  209. package/dist/types/components/utils/ionRenderToString.d.ts +0 -2
  210. package/dist/types/contexts/IonContext.d.ts +0 -7
  211. package/dist/types/contexts/IonLifeCycleContext.d.ts +0 -72
  212. package/dist/types/contexts/NavContext.d.ts +0 -17
  213. package/dist/types/framework-delegate.d.ts +0 -2
  214. package/dist/types/hooks/HookOverlayOptions.d.ts +0 -7
  215. package/dist/types/hooks/__tests__/hooks.spec.d.ts +0 -0
  216. package/dist/types/hooks/useController.d.ts +0 -12
  217. package/dist/types/hooks/useIonActionSheet.d.ts +0 -26
  218. package/dist/types/hooks/useIonAlert.d.ts +0 -26
  219. package/dist/types/hooks/useIonLoading.d.ts +0 -27
  220. package/dist/types/hooks/useIonModal.d.ts +0 -17
  221. package/dist/types/hooks/useIonPicker.d.ts +0 -26
  222. package/dist/types/hooks/useIonPopover.d.ts +0 -17
  223. package/dist/types/hooks/useIonToast.d.ts +0 -26
  224. package/dist/types/hooks/useOverlay.d.ts +0 -13
  225. package/dist/types/index.d.ts +0 -7
  226. package/dist/types/lifecycle/IonLifeCycleHOC.d.ts +0 -31
  227. package/dist/types/lifecycle/hooks.d.ts +0 -5
  228. package/dist/types/lifecycle/index.d.ts +0 -2
  229. package/dist/types/models/ReactComponentOrElement.d.ts +0 -2
  230. package/dist/types/models/RouteAction.d.ts +0 -1
  231. package/dist/types/models/RouteInfo.d.ts +0 -19
  232. package/dist/types/models/RouterDirection.d.ts +0 -1
  233. package/dist/types/models/RouterOptions.d.ts +0 -10
  234. package/dist/types/models/index.d.ts +0 -5
  235. package/dist/types/routing/LocationHistory.d.ts +0 -20
  236. package/dist/types/routing/NavManager.d.ts +0 -38
  237. package/dist/types/routing/OutletPageManager.d.ts +0 -26
  238. package/dist/types/routing/PageManager.d.ts +0 -25
  239. package/dist/types/routing/RouteManagerContext.d.ts +0 -16
  240. package/dist/types/routing/StackContext.d.ts +0 -7
  241. package/dist/types/routing/ViewItem.d.ts +0 -12
  242. package/dist/types/routing/ViewLifeCycleManager.d.ts +0 -42
  243. package/dist/types/routing/ViewStacks.d.ts +0 -19
  244. package/dist/types/routing/__tests__/LocationHistory.spec.d.ts +0 -1
  245. package/dist/types/routing/index.d.ts +0 -7
  246. package/dist/types/utils/HTMLElementSSR.d.ts +0 -4
  247. package/dist/types/utils/generateId.d.ts +0 -1
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ import React from "react";
3
+ import { IonLifeCycleContext } from "../contexts/IonLifeCycleContext";
4
+ export const withIonLifeCycle = (WrappedComponent) => {
5
+ return class IonLifeCycle extends React.Component {
6
+ constructor(props) {
7
+ super(props);
8
+ this.componentRef = React.createRef();
9
+ }
10
+ componentDidMount() {
11
+ const element = this.componentRef.current;
12
+ this.context.onIonViewWillEnter(() => {
13
+ if (element && element.ionViewWillEnter) {
14
+ element.ionViewWillEnter();
15
+ }
16
+ });
17
+ this.context.onIonViewDidEnter(() => {
18
+ if (element && element.ionViewDidEnter) {
19
+ element.ionViewDidEnter();
20
+ }
21
+ });
22
+ this.context.onIonViewWillLeave(() => {
23
+ if (element && element.ionViewWillLeave) {
24
+ element.ionViewWillLeave();
25
+ }
26
+ });
27
+ this.context.onIonViewDidLeave(() => {
28
+ if (element && element.ionViewDidLeave) {
29
+ element.ionViewDidLeave();
30
+ }
31
+ });
32
+ }
33
+ render() {
34
+ return /* @__PURE__ */ React.createElement(IonLifeCycleContext.Consumer, null, (context) => {
35
+ this.context = context;
36
+ return /* @__PURE__ */ React.createElement(WrappedComponent, { ref: this.componentRef, ...this.props });
37
+ });
38
+ }
39
+ };
40
+ };
41
+ //# sourceMappingURL=IonLifeCycleHOC.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/lifecycle/IonLifeCycleHOC.tsx"],
4
+ "sourcesContent": ["import React from 'react';\n\nimport { IonLifeCycleContext } from '../contexts/IonLifeCycleContext';\n\n// TODO(FW-2959): types\n\nexport const withIonLifeCycle = (WrappedComponent: React.ComponentType<any>) => {\n return class IonLifeCycle extends React.Component<any, any> {\n context!: React.ContextType<typeof IonLifeCycleContext>;\n componentRef = React.createRef<any>();\n\n constructor(props: any) {\n super(props);\n }\n\n componentDidMount() {\n const element = this.componentRef.current;\n this.context.onIonViewWillEnter(() => {\n if (element && element.ionViewWillEnter) {\n element.ionViewWillEnter();\n }\n });\n\n this.context.onIonViewDidEnter(() => {\n if (element && element.ionViewDidEnter) {\n element.ionViewDidEnter();\n }\n });\n\n this.context.onIonViewWillLeave(() => {\n if (element && element.ionViewWillLeave) {\n element.ionViewWillLeave();\n }\n });\n\n this.context.onIonViewDidLeave(() => {\n if (element && element.ionViewDidLeave) {\n element.ionViewDidLeave();\n }\n });\n }\n\n render() {\n return (\n <IonLifeCycleContext.Consumer>\n {(context) => {\n this.context = context;\n return <WrappedComponent ref={this.componentRef} {...this.props} />;\n }}\n </IonLifeCycleContext.Consumer>\n );\n }\n };\n};\n"],
5
+ "mappings": ";AAAA,OAAO,WAAW;AAElB,SAAS,2BAA2B;AAI7B,aAAM,mBAAmB,CAAC,qBAA+C;AAC9E,SAAO,MAAM,qBAAqB,MAAM,UAAoB;AAAA,IAI1D,YAAY,OAAY;AACtB,YAAM,KAAK;AAHb,0BAAe,MAAM,UAAe;AAAA,IAIpC;AAAA,IAEA,oBAAoB;AAClB,YAAM,UAAU,KAAK,aAAa;AAClC,WAAK,QAAQ,mBAAmB,MAAM;AACpC,YAAI,WAAW,QAAQ,kBAAkB;AACvC,kBAAQ,iBAAiB;AAAA,QAC3B;AAAA,MACF,CAAC;AAED,WAAK,QAAQ,kBAAkB,MAAM;AACnC,YAAI,WAAW,QAAQ,iBAAiB;AACtC,kBAAQ,gBAAgB;AAAA,QAC1B;AAAA,MACF,CAAC;AAED,WAAK,QAAQ,mBAAmB,MAAM;AACpC,YAAI,WAAW,QAAQ,kBAAkB;AACvC,kBAAQ,iBAAiB;AAAA,QAC3B;AAAA,MACF,CAAC;AAED,WAAK,QAAQ,kBAAkB,MAAM;AACnC,YAAI,WAAW,QAAQ,iBAAiB;AACtC,kBAAQ,gBAAgB;AAAA,QAC1B;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IAEA,SAAS;AACP,aACE,oCAAC,oBAAoB,UAApB,MACE,CAAC,YAAY;AACZ,aAAK,UAAU;AACf,eAAO,oCAAC,oBAAiB,KAAK,KAAK,cAAe,GAAG,KAAK,OAAO;AAAA,MACnE,CACF;AAAA,IAEJ;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ import { useContext, useEffect, useRef } from "react";
3
+ import { IonLifeCycleContext } from "../contexts/IonLifeCycleContext";
4
+ export const useIonViewWillEnter = (callback, deps = []) => {
5
+ const context = useContext(IonLifeCycleContext);
6
+ const id = useRef();
7
+ id.current = id.current || Math.floor(Math.random() * 1e6);
8
+ useEffect(() => {
9
+ callback.id = id.current;
10
+ context.onIonViewWillEnter(callback);
11
+ return () => {
12
+ context.cleanupIonViewWillEnter(callback);
13
+ };
14
+ }, deps);
15
+ };
16
+ export const useIonViewDidEnter = (callback, deps = []) => {
17
+ const context = useContext(IonLifeCycleContext);
18
+ const id = useRef();
19
+ id.current = id.current || Math.floor(Math.random() * 1e6);
20
+ useEffect(() => {
21
+ callback.id = id.current;
22
+ context.onIonViewDidEnter(callback);
23
+ return () => {
24
+ context.cleanupIonViewDidEnter(callback);
25
+ };
26
+ }, deps);
27
+ };
28
+ export const useIonViewWillLeave = (callback, deps = []) => {
29
+ const context = useContext(IonLifeCycleContext);
30
+ const id = useRef();
31
+ id.current = id.current || Math.floor(Math.random() * 1e6);
32
+ useEffect(() => {
33
+ callback.id = id.current;
34
+ context.onIonViewWillLeave(callback);
35
+ return () => {
36
+ context.cleanupIonViewWillLeave(callback);
37
+ };
38
+ }, deps);
39
+ };
40
+ export const useIonViewDidLeave = (callback, deps = []) => {
41
+ const context = useContext(IonLifeCycleContext);
42
+ const id = useRef();
43
+ id.current = id.current || Math.floor(Math.random() * 1e6);
44
+ useEffect(() => {
45
+ callback.id = id.current;
46
+ context.onIonViewDidLeave(callback);
47
+ return () => {
48
+ context.cleanupIonViewDidLeave(callback);
49
+ };
50
+ }, deps);
51
+ };
52
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/lifecycle/hooks.ts"],
4
+ "sourcesContent": ["import { useContext, useEffect, useRef } from 'react';\n\nimport type { LifeCycleCallback } from '../contexts/IonLifeCycleContext';\nimport { IonLifeCycleContext } from '../contexts/IonLifeCycleContext';\n\nexport const useIonViewWillEnter = (callback: LifeCycleCallback, deps: any[] = []) => {\n const context = useContext(IonLifeCycleContext);\n const id = useRef<number | undefined>();\n id.current = id.current || Math.floor(Math.random() * 1000000);\n useEffect(() => {\n callback.id = id.current!;\n context.onIonViewWillEnter(callback);\n return () => {\n context.cleanupIonViewWillEnter(callback);\n };\n }, deps);\n};\n\nexport const useIonViewDidEnter = (callback: LifeCycleCallback, deps: any[] = []) => {\n const context = useContext(IonLifeCycleContext);\n const id = useRef<number | undefined>();\n id.current = id.current || Math.floor(Math.random() * 1000000);\n useEffect(() => {\n callback.id = id.current!;\n context.onIonViewDidEnter(callback);\n return () => {\n context.cleanupIonViewDidEnter(callback);\n };\n }, deps);\n};\n\nexport const useIonViewWillLeave = (callback: LifeCycleCallback, deps: any[] = []) => {\n const context = useContext(IonLifeCycleContext);\n const id = useRef<number | undefined>();\n id.current = id.current || Math.floor(Math.random() * 1000000);\n useEffect(() => {\n callback.id = id.current!;\n context.onIonViewWillLeave(callback);\n return () => {\n context.cleanupIonViewWillLeave(callback);\n };\n }, deps);\n};\n\nexport const useIonViewDidLeave = (callback: LifeCycleCallback, deps: any[] = []) => {\n const context = useContext(IonLifeCycleContext);\n const id = useRef<number | undefined>();\n id.current = id.current || Math.floor(Math.random() * 1000000);\n useEffect(() => {\n callback.id = id.current!;\n context.onIonViewDidLeave(callback);\n return () => {\n context.cleanupIonViewDidLeave(callback);\n };\n }, deps);\n};\n"],
5
+ "mappings": ";AAAA,SAAS,YAAY,WAAW,cAAc;AAG9C,SAAS,2BAA2B;AAE7B,aAAM,sBAAsB,CAAC,UAA6B,OAAc,CAAC,MAAM;AACpF,QAAM,UAAU,WAAW,mBAAmB;AAC9C,QAAM,KAAK,OAA2B;AACtC,KAAG,UAAU,GAAG,WAAW,KAAK,MAAM,KAAK,OAAO,IAAI,GAAO;AAC7D,YAAU,MAAM;AACd,aAAS,KAAK,GAAG;AACjB,YAAQ,mBAAmB,QAAQ;AACnC,WAAO,MAAM;AACX,cAAQ,wBAAwB,QAAQ;AAAA,IAC1C;AAAA,EACF,GAAG,IAAI;AACT;AAEO,aAAM,qBAAqB,CAAC,UAA6B,OAAc,CAAC,MAAM;AACnF,QAAM,UAAU,WAAW,mBAAmB;AAC9C,QAAM,KAAK,OAA2B;AACtC,KAAG,UAAU,GAAG,WAAW,KAAK,MAAM,KAAK,OAAO,IAAI,GAAO;AAC7D,YAAU,MAAM;AACd,aAAS,KAAK,GAAG;AACjB,YAAQ,kBAAkB,QAAQ;AAClC,WAAO,MAAM;AACX,cAAQ,uBAAuB,QAAQ;AAAA,IACzC;AAAA,EACF,GAAG,IAAI;AACT;AAEO,aAAM,sBAAsB,CAAC,UAA6B,OAAc,CAAC,MAAM;AACpF,QAAM,UAAU,WAAW,mBAAmB;AAC9C,QAAM,KAAK,OAA2B;AACtC,KAAG,UAAU,GAAG,WAAW,KAAK,MAAM,KAAK,OAAO,IAAI,GAAO;AAC7D,YAAU,MAAM;AACd,aAAS,KAAK,GAAG;AACjB,YAAQ,mBAAmB,QAAQ;AACnC,WAAO,MAAM;AACX,cAAQ,wBAAwB,QAAQ;AAAA,IAC1C;AAAA,EACF,GAAG,IAAI;AACT;AAEO,aAAM,qBAAqB,CAAC,UAA6B,OAAc,CAAC,MAAM;AACnF,QAAM,UAAU,WAAW,mBAAmB;AAC9C,QAAM,KAAK,OAA2B;AACtC,KAAG,UAAU,GAAG,WAAW,KAAK,MAAM,KAAK,OAAO,IAAI,GAAO;AAC7D,YAAU,MAAM;AACd,aAAS,KAAK,GAAG;AACjB,YAAQ,kBAAkB,QAAQ;AAClC,WAAO,MAAM;AACX,cAAQ,uBAAuB,QAAQ;AAAA,IACzC;AAAA,EACF,GAAG,IAAI;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ export { withIonLifeCycle } from "./IonLifeCycleHOC";
3
+ export { useIonViewDidEnter, useIonViewDidLeave, useIonViewWillEnter, useIonViewWillLeave } from "./hooks";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/lifecycle/index.ts"],
4
+ "sourcesContent": ["export { withIonLifeCycle } from './IonLifeCycleHOC';\nexport { useIonViewDidEnter, useIonViewDidLeave, useIonViewWillEnter, useIonViewWillLeave } from './hooks';\n"],
5
+ "mappings": ";AAAA,SAAS,wBAAwB;AACjC,SAAS,oBAAoB,oBAAoB,qBAAqB,2BAA2B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=ReactComponentOrElement.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=RouteAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=RouteInfo.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=RouterDirection.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=RouterOptions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ export * from "./RouteAction";
3
+ export * from "./RouteInfo";
4
+ export * from "./RouterDirection";
5
+ export * from "./RouterOptions";
6
+ export * from "./ReactComponentOrElement";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/models/index.ts"],
4
+ "sourcesContent": ["export * from './RouteAction';\nexport * from './RouteInfo';\nexport * from './RouterDirection';\nexport * from './RouterOptions';\nexport * from './ReactComponentOrElement';\n"],
5
+ "mappings": ";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ export class LocationHistory {
3
+ constructor() {
4
+ this.locationHistory = [];
5
+ this.tabHistory = {};
6
+ }
7
+ add(routeInfo) {
8
+ if (routeInfo.routeAction === "push" || routeInfo.routeAction == null) {
9
+ this._add(routeInfo);
10
+ } else if (routeInfo.routeAction === "pop") {
11
+ this._pop(routeInfo);
12
+ } else if (routeInfo.routeAction === "replace") {
13
+ this._replace(routeInfo);
14
+ }
15
+ if (routeInfo.routeDirection === "root") {
16
+ this._clear();
17
+ this._add(routeInfo);
18
+ }
19
+ }
20
+ clearTabStack(tab) {
21
+ const routeInfos = this._getRouteInfosByKey(tab);
22
+ if (routeInfos) {
23
+ routeInfos.forEach((ri) => {
24
+ this.locationHistory = this.locationHistory.filter((x) => x.id !== ri.id);
25
+ });
26
+ this.tabHistory[tab] = [];
27
+ }
28
+ }
29
+ update(routeInfo) {
30
+ const locationIndex = this.locationHistory.findIndex((x) => x.id === routeInfo.id);
31
+ if (locationIndex > -1) {
32
+ this.locationHistory.splice(locationIndex, 1, routeInfo);
33
+ }
34
+ const tabArray = this.tabHistory[routeInfo.tab || ""];
35
+ if (tabArray) {
36
+ const tabIndex = tabArray.findIndex((x) => x.id === routeInfo.id);
37
+ if (tabIndex > -1) {
38
+ tabArray.splice(tabIndex, 1, routeInfo);
39
+ } else {
40
+ tabArray.push(routeInfo);
41
+ }
42
+ } else if (routeInfo.tab) {
43
+ this.tabHistory[routeInfo.tab] = [routeInfo];
44
+ }
45
+ }
46
+ _add(routeInfo) {
47
+ const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
48
+ if (routeInfos) {
49
+ if (this._areRoutesEqual(routeInfos[routeInfos.length - 1], routeInfo)) {
50
+ routeInfos.pop();
51
+ }
52
+ routeInfos.push(routeInfo);
53
+ }
54
+ this.locationHistory.push(routeInfo);
55
+ }
56
+ _areRoutesEqual(route1, route2) {
57
+ if (!route1 || !route2) {
58
+ return false;
59
+ }
60
+ return route1.pathname === route2.pathname && route1.search === route2.search;
61
+ }
62
+ _pop(routeInfo) {
63
+ const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
64
+ if (routeInfos) {
65
+ routeInfos.pop();
66
+ routeInfos.pop();
67
+ routeInfos.push(routeInfo);
68
+ }
69
+ this.locationHistory.pop();
70
+ this.locationHistory.pop();
71
+ this.locationHistory.push(routeInfo);
72
+ }
73
+ _replace(routeInfo) {
74
+ const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
75
+ routeInfos && routeInfos.pop();
76
+ this.locationHistory.pop();
77
+ this._add(routeInfo);
78
+ }
79
+ _clear() {
80
+ const keys = Object.keys(this.tabHistory);
81
+ keys.forEach((k) => this.tabHistory[k] = []);
82
+ this.locationHistory = [];
83
+ }
84
+ _getRouteInfosByKey(key) {
85
+ let routeInfos;
86
+ if (key) {
87
+ routeInfos = this.tabHistory[key];
88
+ if (!routeInfos) {
89
+ routeInfos = this.tabHistory[key] = [];
90
+ }
91
+ }
92
+ return routeInfos;
93
+ }
94
+ getFirstRouteInfoForTab(tab) {
95
+ const routeInfos = this._getRouteInfosByKey(tab);
96
+ if (routeInfos) {
97
+ return routeInfos[0];
98
+ }
99
+ return void 0;
100
+ }
101
+ getCurrentRouteInfoForTab(tab) {
102
+ const routeInfos = this._getRouteInfosByKey(tab);
103
+ if (routeInfos) {
104
+ return routeInfos[routeInfos.length - 1];
105
+ }
106
+ return void 0;
107
+ }
108
+ findLastLocation(routeInfo) {
109
+ const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
110
+ if (routeInfos) {
111
+ for (let i = routeInfos.length - 2; i >= 0; i--) {
112
+ const ri = routeInfos[i];
113
+ if (ri) {
114
+ if (ri.pathname === routeInfo.pushedByRoute) {
115
+ return ri;
116
+ }
117
+ }
118
+ }
119
+ }
120
+ for (let i = this.locationHistory.length - 2; i >= 0; i--) {
121
+ const ri = this.locationHistory[i];
122
+ if (ri) {
123
+ if (ri.pathname === routeInfo.pushedByRoute) {
124
+ return ri;
125
+ }
126
+ }
127
+ }
128
+ return void 0;
129
+ }
130
+ previous() {
131
+ return this.locationHistory[this.locationHistory.length - 2] || this.locationHistory[this.locationHistory.length - 1];
132
+ }
133
+ current() {
134
+ return this.locationHistory[this.locationHistory.length - 1];
135
+ }
136
+ canGoBack() {
137
+ return this.locationHistory.length > 1;
138
+ }
139
+ }
140
+ //# sourceMappingURL=LocationHistory.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/routing/LocationHistory.ts"],
4
+ "sourcesContent": ["import type { RouteInfo } from '../models/RouteInfo';\n\n// const RESTRICT_SIZE = 100;\n\nexport class LocationHistory {\n private locationHistory: RouteInfo[] = [];\n private tabHistory: {\n [key: string]: RouteInfo[];\n } = {};\n\n add(routeInfo: RouteInfo) {\n if (routeInfo.routeAction === 'push' || routeInfo.routeAction == null) {\n this._add(routeInfo);\n } else if (routeInfo.routeAction === 'pop') {\n this._pop(routeInfo);\n } else if (routeInfo.routeAction === 'replace') {\n this._replace(routeInfo);\n }\n\n if (routeInfo.routeDirection === 'root') {\n this._clear();\n this._add(routeInfo);\n }\n }\n\n clearTabStack(tab: string) {\n const routeInfos = this._getRouteInfosByKey(tab);\n if (routeInfos) {\n routeInfos.forEach((ri) => {\n this.locationHistory = this.locationHistory.filter((x) => x.id !== ri.id);\n });\n this.tabHistory[tab] = [];\n }\n }\n\n update(routeInfo: RouteInfo) {\n const locationIndex = this.locationHistory.findIndex((x) => x.id === routeInfo.id);\n if (locationIndex > -1) {\n this.locationHistory.splice(locationIndex, 1, routeInfo);\n }\n const tabArray = this.tabHistory[routeInfo.tab || ''];\n if (tabArray) {\n const tabIndex = tabArray.findIndex((x) => x.id === routeInfo.id);\n if (tabIndex > -1) {\n tabArray.splice(tabIndex, 1, routeInfo);\n } else {\n tabArray.push(routeInfo);\n }\n } else if (routeInfo.tab) {\n this.tabHistory[routeInfo.tab] = [routeInfo];\n }\n }\n\n private _add(routeInfo: RouteInfo) {\n const routeInfos = this._getRouteInfosByKey(routeInfo.tab);\n if (routeInfos) {\n // If the latest routeInfo is the same (going back and forth between tabs), replace it\n if (this._areRoutesEqual(routeInfos[routeInfos.length - 1], routeInfo)) {\n routeInfos.pop();\n }\n routeInfos.push(routeInfo);\n }\n this.locationHistory.push(routeInfo);\n }\n\n private _areRoutesEqual(route1?: RouteInfo, route2?: RouteInfo) {\n if (!route1 || !route2) {\n return false;\n }\n return route1.pathname === route2.pathname && route1.search === route2.search;\n }\n\n private _pop(routeInfo: RouteInfo) {\n const routeInfos = this._getRouteInfosByKey(routeInfo.tab);\n\n if (routeInfos) {\n // Pop the previous route\n routeInfos.pop();\n // Replace the current route with an updated version\n routeInfos.pop();\n routeInfos.push(routeInfo);\n }\n\n // Pop the previous route\n this.locationHistory.pop();\n // Replace the current route with an updated version\n this.locationHistory.pop();\n this.locationHistory.push(routeInfo);\n }\n\n private _replace(routeInfo: RouteInfo) {\n const routeInfos = this._getRouteInfosByKey(routeInfo.tab);\n routeInfos && routeInfos.pop();\n this.locationHistory.pop();\n this._add(routeInfo);\n }\n\n private _clear() {\n const keys = Object.keys(this.tabHistory);\n keys.forEach((k) => (this.tabHistory[k] = []));\n this.locationHistory = [];\n }\n\n private _getRouteInfosByKey(key?: string) {\n let routeInfos: RouteInfo[] | undefined;\n if (key) {\n routeInfos = this.tabHistory[key];\n if (!routeInfos) {\n routeInfos = this.tabHistory[key] = [];\n }\n }\n return routeInfos;\n }\n\n getFirstRouteInfoForTab(tab: string) {\n const routeInfos = this._getRouteInfosByKey(tab);\n if (routeInfos) {\n return routeInfos[0];\n }\n return undefined;\n }\n\n getCurrentRouteInfoForTab(tab?: string) {\n const routeInfos = this._getRouteInfosByKey(tab);\n if (routeInfos) {\n return routeInfos[routeInfos.length - 1];\n }\n return undefined;\n }\n\n findLastLocation(routeInfo: RouteInfo) {\n const routeInfos = this._getRouteInfosByKey(routeInfo.tab);\n if (routeInfos) {\n for (let i = routeInfos.length - 2; i >= 0; i--) {\n const ri = routeInfos[i];\n if (ri) {\n if (ri.pathname === routeInfo.pushedByRoute) {\n return ri;\n }\n }\n }\n }\n for (let i = this.locationHistory.length - 2; i >= 0; i--) {\n const ri = this.locationHistory[i];\n if (ri) {\n if (ri.pathname === routeInfo.pushedByRoute) {\n return ri;\n }\n }\n }\n return undefined;\n }\n\n previous() {\n return (\n this.locationHistory[this.locationHistory.length - 2] || this.locationHistory[this.locationHistory.length - 1]\n );\n }\n\n current() {\n return this.locationHistory[this.locationHistory.length - 1];\n }\n\n canGoBack() {\n return this.locationHistory.length > 1;\n }\n}\n"],
5
+ "mappings": ";AAIO,aAAM,gBAAgB;AAAA,EAAtB;AACL,SAAQ,kBAA+B,CAAC;AACxC,SAAQ,aAEJ,CAAC;AAAA;AAAA,EAEL,IAAI,WAAsB;AACxB,QAAI,UAAU,gBAAgB,UAAU,UAAU,eAAe,MAAM;AACrE,WAAK,KAAK,SAAS;AAAA,IACrB,WAAW,UAAU,gBAAgB,OAAO;AAC1C,WAAK,KAAK,SAAS;AAAA,IACrB,WAAW,UAAU,gBAAgB,WAAW;AAC9C,WAAK,SAAS,SAAS;AAAA,IACzB;AAEA,QAAI,UAAU,mBAAmB,QAAQ;AACvC,WAAK,OAAO;AACZ,WAAK,KAAK,SAAS;AAAA,IACrB;AAAA,EACF;AAAA,EAEA,cAAc,KAAa;AACzB,UAAM,aAAa,KAAK,oBAAoB,GAAG;AAC/C,QAAI,YAAY;AACd,iBAAW,QAAQ,CAAC,OAAO;AACzB,aAAK,kBAAkB,KAAK,gBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,EAA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K,GAAG,KAAK;AACzD,YAAM,KAAK,KAAK,gBAAgB,CAAC;AACjC,UAAI,IAAI;AACN,YAAI,GAAG,aAAa,UAAU,eAAe;AAC3C,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEA,WAAW;AACT,WACE,KAAK,gBAAgB,KAAK,gBAAgB,SAAS,CAAC,KAAK,KAAK,gBAAgB,KAAK,gBAAgB,SAAS,CAAC;AAAA,EAEjH;AAAA,EAEA,UAAU;AACR,WAAO,KAAK,gBAAgB,KAAK,gBAAgB,SAAS,CAAC;AAAA,EAC7D;AAAA,EAEA,YAAY;AACV,WAAO,KAAK,gBAAgB,SAAS;AAAA,EACvC;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ import React from "react";
3
+ import { IonRouterContext } from "../components/IonRouterContext";
4
+ import { NavContext } from "../contexts/NavContext";
5
+ import PageManager from "./PageManager";
6
+ export class NavManager extends React.PureComponent {
7
+ constructor(props) {
8
+ super(props);
9
+ this.ionRouterContextValue = {
10
+ push: (pathname, routerDirection, routeAction, routerOptions, animationBuilder) => {
11
+ this.navigate(pathname, routerDirection, routeAction, animationBuilder, routerOptions);
12
+ },
13
+ back: (animationBuilder) => {
14
+ this.goBack(void 0, animationBuilder);
15
+ },
16
+ canGoBack: () => this.props.locationHistory.canGoBack(),
17
+ nativeBack: () => this.props.onNativeBack(),
18
+ routeInfo: this.props.routeInfo
19
+ };
20
+ this.state = {
21
+ goBack: this.goBack.bind(this),
22
+ hasIonicRouter: () => true,
23
+ navigate: this.navigate.bind(this),
24
+ getIonRedirect: this.getIonRedirect.bind(this),
25
+ getIonRoute: this.getIonRoute.bind(this),
26
+ getStackManager: this.getStackManager.bind(this),
27
+ getPageManager: this.getPageManager.bind(this),
28
+ routeInfo: this.props.routeInfo,
29
+ setCurrentTab: this.props.onSetCurrentTab,
30
+ changeTab: this.props.onChangeTab,
31
+ resetTab: this.props.onResetTab
32
+ };
33
+ }
34
+ componentDidMount() {
35
+ if (typeof document !== "undefined") {
36
+ this.handleHardwareBackButton = this.handleHardwareBackButton.bind(this);
37
+ document.addEventListener("ionBackButton", this.handleHardwareBackButton);
38
+ }
39
+ }
40
+ componentWillUnmount() {
41
+ if (typeof document !== "undefined") {
42
+ document.removeEventListener("ionBackButton", this.handleHardwareBackButton);
43
+ }
44
+ }
45
+ handleHardwareBackButton(e) {
46
+ e.detail.register(0, (processNextHandler) => {
47
+ this.nativeGoBack();
48
+ processNextHandler();
49
+ });
50
+ }
51
+ goBack(route, animationBuilder) {
52
+ this.props.onNavigateBack(route, animationBuilder);
53
+ }
54
+ nativeGoBack() {
55
+ this.props.onNativeBack();
56
+ }
57
+ navigate(path, direction = "forward", action = "push", animationBuilder, options, tab) {
58
+ this.props.onNavigate(path, action, direction, animationBuilder, options, tab);
59
+ }
60
+ getPageManager() {
61
+ return PageManager;
62
+ }
63
+ getIonRedirect() {
64
+ return this.props.ionRedirect;
65
+ }
66
+ getIonRoute() {
67
+ return this.props.ionRoute;
68
+ }
69
+ getStackManager() {
70
+ return this.props.stackManager;
71
+ }
72
+ render() {
73
+ return /* @__PURE__ */ React.createElement(NavContext.Provider, { value: { ...this.state, routeInfo: this.props.routeInfo } }, /* @__PURE__ */ React.createElement(IonRouterContext.Provider, { value: { ...this.ionRouterContextValue, routeInfo: this.props.routeInfo } }, this.props.children));
74
+ }
75
+ }
76
+ //# sourceMappingURL=NavManager.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/routing/NavManager.tsx"],
4
+ "sourcesContent": ["import type { AnimationBuilder } from '@ionic/core/components';\nimport React from 'react';\n\nimport type { IonRouterContextState } from '../components/IonRouterContext';\nimport { IonRouterContext } from '../components/IonRouterContext';\nimport type { NavContextState } from '../contexts/NavContext';\nimport { NavContext } from '../contexts/NavContext';\nimport type { RouteAction } from '../models/RouteAction';\nimport type { RouteInfo } from '../models/RouteInfo';\nimport type { RouterDirection } from '../models/RouterDirection';\nimport type { RouterOptions } from '../models/RouterOptions';\n\nimport type { LocationHistory } from './LocationHistory';\nimport PageManager from './PageManager';\n\n// TODO(FW-2959): types\n\ninterface NavManagerProps {\n routeInfo: RouteInfo;\n onNativeBack: () => void;\n onNavigateBack: (route?: string | RouteInfo, animationBuilder?: AnimationBuilder) => void;\n onNavigate: (\n path: string,\n action: RouteAction,\n direction?: RouterDirection,\n animationBuilder?: AnimationBuilder,\n options?: any,\n tab?: string\n ) => void;\n onSetCurrentTab: (tab: string, routeInfo: RouteInfo) => void;\n onChangeTab: (tab: string, path: string, routeOptions?: any) => void;\n onResetTab: (tab: string, path: string, routeOptions?: any) => void;\n ionRedirect: any;\n ionRoute: any;\n stackManager: any;\n locationHistory: LocationHistory;\n}\n\nexport class NavManager extends React.PureComponent<NavManagerProps, NavContextState> {\n ionRouterContextValue: IonRouterContextState = {\n push: (\n pathname: string,\n routerDirection?: RouterDirection,\n routeAction?: RouteAction,\n routerOptions?: RouterOptions,\n animationBuilder?: AnimationBuilder\n ) => {\n this.navigate(pathname, routerDirection, routeAction, animationBuilder, routerOptions);\n },\n back: (animationBuilder?: AnimationBuilder) => {\n this.goBack(undefined, animationBuilder);\n },\n canGoBack: () => this.props.locationHistory.canGoBack(),\n nativeBack: () => this.props.onNativeBack(),\n routeInfo: this.props.routeInfo,\n };\n\n constructor(props: NavManagerProps) {\n super(props);\n this.state = {\n goBack: this.goBack.bind(this),\n hasIonicRouter: () => true,\n navigate: this.navigate.bind(this),\n getIonRedirect: this.getIonRedirect.bind(this),\n getIonRoute: this.getIonRoute.bind(this),\n getStackManager: this.getStackManager.bind(this),\n getPageManager: this.getPageManager.bind(this),\n routeInfo: this.props.routeInfo,\n setCurrentTab: this.props.onSetCurrentTab,\n changeTab: this.props.onChangeTab,\n resetTab: this.props.onResetTab,\n };\n }\n\n componentDidMount() {\n if (typeof document !== 'undefined') {\n this.handleHardwareBackButton = this.handleHardwareBackButton.bind(this);\n document.addEventListener('ionBackButton', this.handleHardwareBackButton);\n }\n }\n\n componentWillUnmount() {\n if (typeof document !== 'undefined') {\n document.removeEventListener('ionBackButton', this.handleHardwareBackButton);\n }\n }\n\n handleHardwareBackButton(e: any) {\n e.detail.register(0, (processNextHandler: () => void) => {\n this.nativeGoBack();\n processNextHandler();\n });\n }\n\n goBack(route?: string | RouteInfo, animationBuilder?: AnimationBuilder) {\n this.props.onNavigateBack(route, animationBuilder);\n }\n\n nativeGoBack() {\n this.props.onNativeBack();\n }\n\n navigate(\n path: string,\n direction: RouterDirection = 'forward',\n action: RouteAction = 'push',\n animationBuilder?: AnimationBuilder,\n options?: any,\n tab?: string\n ) {\n this.props.onNavigate(path, action, direction, animationBuilder, options, tab);\n }\n\n getPageManager() {\n return PageManager;\n }\n\n getIonRedirect() {\n return this.props.ionRedirect;\n }\n\n getIonRoute() {\n return this.props.ionRoute;\n }\n\n getStackManager() {\n return this.props.stackManager;\n }\n\n render() {\n return (\n <NavContext.Provider value={{ ...this.state, routeInfo: this.props.routeInfo }}>\n <IonRouterContext.Provider value={{ ...this.ionRouterContextValue, routeInfo: this.props.routeInfo }}>\n {this.props.children}\n </IonRouterContext.Provider>\n </NavContext.Provider>\n );\n }\n}\n"],
5
+ "mappings": ";AACA,OAAO,WAAW;AAGlB,SAAS,wBAAwB;AAEjC,SAAS,kBAAkB;AAO3B,OAAO,iBAAiB;AAyBjB,aAAM,mBAAmB,MAAM,cAAgD;AAAA,EAmBpF,YAAY,OAAwB;AAClC,UAAM,KAAK;AAnBb,iCAA+C;AAAA,MAC7C,MAAM,CACJ,UACA,iBACA,aACA,eACA,qBACG;AACH,aAAK,SAAS,UAAU,iBAAiB,aAAa,kBAAkB,aAAa;AAAA,MACvF;AAAA,MACA,MAAM,CAAC,qBAAwC;AAC7C,aAAK,OAAO,QAAW,gBAAgB;AAAA,MACzC;AAAA,MACA,WAAW,MAAM,KAAK,MAAM,gBAAgB,UAAU;AAAA,MACtD,YAAY,MAAM,KAAK,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f,WAAO;AAAA,EACT;AAAA,EAEA,iBAAiB;AACf,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAEA,cAAc;AACZ,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAEA,kBAAkB;AAChB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAEA,SAAS;AACP,WACE,oCAAC,WAAW,UAAX,EAAoB,OAAO,EAAE,GAAG,KAAK,OAAO,WAAW,KAAK,MAAM,UAAU,KAC3E,oCAAC,iBAAiB,UAAjB,EAA0B,OAAO,EAAE,GAAG,KAAK,uBAAuB,WAAW,KAAK,MAAM,UAAU,KAChG,KAAK,MAAM,QACd,CACF;AAAA,EAEJ;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ import { componentOnReady } from "@ionic/core/components";
3
+ import React from "react";
4
+ import { IonRouterOutletInner } from "../components/inner-proxies";
5
+ import { IonLifeCycleContext } from "../contexts/IonLifeCycleContext";
6
+ import { StackContext } from "./StackContext";
7
+ export class OutletPageManager extends React.Component {
8
+ constructor(props) {
9
+ super(props);
10
+ this.outletIsReady = false;
11
+ this.ionViewWillEnterHandler = this.ionViewWillEnterHandler.bind(this);
12
+ this.ionViewDidEnterHandler = this.ionViewDidEnterHandler.bind(this);
13
+ this.ionViewWillLeaveHandler = this.ionViewWillLeaveHandler.bind(this);
14
+ this.ionViewDidLeaveHandler = this.ionViewDidLeaveHandler.bind(this);
15
+ }
16
+ componentDidMount() {
17
+ if (this.ionRouterOutlet) {
18
+ if (!this.outletIsReady) {
19
+ componentOnReady(this.ionRouterOutlet, () => {
20
+ this.outletIsReady = true;
21
+ this.context.registerIonPage(this.ionRouterOutlet, this.props.routeInfo);
22
+ });
23
+ }
24
+ this.ionRouterOutlet.addEventListener("ionViewWillEnter", this.ionViewWillEnterHandler);
25
+ this.ionRouterOutlet.addEventListener("ionViewDidEnter", this.ionViewDidEnterHandler);
26
+ this.ionRouterOutlet.addEventListener("ionViewWillLeave", this.ionViewWillLeaveHandler);
27
+ this.ionRouterOutlet.addEventListener("ionViewDidLeave", this.ionViewDidLeaveHandler);
28
+ }
29
+ }
30
+ componentWillUnmount() {
31
+ if (this.ionRouterOutlet) {
32
+ this.ionRouterOutlet.removeEventListener("ionViewWillEnter", this.ionViewWillEnterHandler);
33
+ this.ionRouterOutlet.removeEventListener("ionViewDidEnter", this.ionViewDidEnterHandler);
34
+ this.ionRouterOutlet.removeEventListener("ionViewWillLeave", this.ionViewWillLeaveHandler);
35
+ this.ionRouterOutlet.removeEventListener("ionViewDidLeave", this.ionViewDidLeaveHandler);
36
+ }
37
+ }
38
+ ionViewWillEnterHandler() {
39
+ this.ionLifeCycleContext.ionViewWillEnter();
40
+ }
41
+ ionViewDidEnterHandler() {
42
+ this.ionLifeCycleContext.ionViewDidEnter();
43
+ }
44
+ ionViewWillLeaveHandler() {
45
+ this.ionLifeCycleContext.ionViewWillLeave();
46
+ }
47
+ ionViewDidLeaveHandler() {
48
+ this.ionLifeCycleContext.ionViewDidLeave();
49
+ }
50
+ render() {
51
+ const { StackManager, children, routeInfo, ...props } = this.props;
52
+ return /* @__PURE__ */ React.createElement(IonLifeCycleContext.Consumer, null, (context) => {
53
+ this.ionLifeCycleContext = context;
54
+ return /* @__PURE__ */ React.createElement(StackManager, { routeInfo }, /* @__PURE__ */ React.createElement(
55
+ IonRouterOutletInner,
56
+ {
57
+ setRef: (val) => this.ionRouterOutlet = val,
58
+ ...props
59
+ },
60
+ children
61
+ ));
62
+ });
63
+ }
64
+ static get contextType() {
65
+ return StackContext;
66
+ }
67
+ }
68
+ export default OutletPageManager;
69
+ //# sourceMappingURL=OutletPageManager.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/routing/OutletPageManager.tsx"],
4
+ "sourcesContent": ["import { componentOnReady } from '@ionic/core/components';\nimport React from 'react';\n\nimport { IonRouterOutletInner } from '../components/inner-proxies';\nimport { IonLifeCycleContext } from '../contexts/IonLifeCycleContext';\nimport type { RouteInfo } from '../models';\n\nimport { StackContext } from './StackContext';\n\ninterface OutletPageManagerProps {\n className?: string;\n forwardedRef?: React.ForwardedRef<HTMLIonRouterOutletElement>;\n routeInfo?: RouteInfo;\n StackManager: any; // TODO(FW-2959): type\n}\n\nexport class OutletPageManager extends React.Component<OutletPageManagerProps> {\n ionLifeCycleContext!: React.ContextType<typeof IonLifeCycleContext>;\n context!: React.ContextType<typeof StackContext>;\n ionRouterOutlet: HTMLIonRouterOutletElement | undefined;\n outletIsReady: boolean;\n\n constructor(props: OutletPageManagerProps) {\n super(props);\n\n this.outletIsReady = false;\n\n /**\n * This binds the scope of the following methods to the class scope.\n * The `.bind` method returns a new function, so we need to assign it\n * in the constructor rather than when adding or removing the listeners\n * to avoid creating a new function.\n */\n this.ionViewWillEnterHandler = this.ionViewWillEnterHandler.bind(this);\n this.ionViewDidEnterHandler = this.ionViewDidEnterHandler.bind(this);\n this.ionViewWillLeaveHandler = this.ionViewWillLeaveHandler.bind(this);\n this.ionViewDidLeaveHandler = this.ionViewDidLeaveHandler.bind(this);\n }\n\n componentDidMount() {\n if (this.ionRouterOutlet) {\n /**\n * This avoids multiple raf calls\n * when React unmounts + remounts components.\n */\n if (!this.outletIsReady) {\n componentOnReady(this.ionRouterOutlet, () => {\n this.outletIsReady = true;\n this.context.registerIonPage(this.ionRouterOutlet!, this.props.routeInfo!);\n });\n }\n\n this.ionRouterOutlet.addEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);\n this.ionRouterOutlet.addEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);\n this.ionRouterOutlet.addEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);\n this.ionRouterOutlet.addEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);\n }\n }\n\n componentWillUnmount() {\n if (this.ionRouterOutlet) {\n this.ionRouterOutlet.removeEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);\n this.ionRouterOutlet.removeEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);\n this.ionRouterOutlet.removeEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);\n this.ionRouterOutlet.removeEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);\n }\n }\n\n ionViewWillEnterHandler() {\n this.ionLifeCycleContext.ionViewWillEnter();\n }\n\n ionViewDidEnterHandler() {\n this.ionLifeCycleContext.ionViewDidEnter();\n }\n\n ionViewWillLeaveHandler() {\n this.ionLifeCycleContext.ionViewWillLeave();\n }\n\n ionViewDidLeaveHandler() {\n this.ionLifeCycleContext.ionViewDidLeave();\n }\n\n render() {\n const { StackManager, children, routeInfo, ...props } = this.props;\n return (\n <IonLifeCycleContext.Consumer>\n {(context) => {\n this.ionLifeCycleContext = context;\n return (\n <StackManager routeInfo={routeInfo}>\n <IonRouterOutletInner\n setRef={(val: HTMLIonRouterOutletElement) => (this.ionRouterOutlet = val)}\n {...props}\n >\n {children}\n </IonRouterOutletInner>\n </StackManager>\n );\n }}\n </IonLifeCycleContext.Consumer>\n );\n }\n\n static get contextType() {\n return StackContext;\n }\n}\nexport default OutletPageManager;\n"],
5
+ "mappings": ";AAAA,SAAS,wBAAwB;AACjC,OAAO,WAAW;AAElB,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AAGpC,SAAS,oBAAoB;AAStB,aAAM,0BAA0B,MAAM,UAAkC;AAAA,EAM7E,YAAY,OAA+B;AACzC,UAAM,KAAK;AAEX,SAAK,gBAAgB;AAQrB,SAAK,0BAA0B,KAAK,wBAAwB,KAAK,IAAI;AACrE,SAAK,yBAAyB,KAAK,uBAAuB,KAAK,IAAI;AACnE,SAAK,0BAA0B,KAAK,wBAAwB,KAAK,IAAI;AACrE,SAAK,yBAAyB,KAAK,uBAAuB,KAAK,IAAI;AAAA,EACrE;AAAA,EAEA,oBAAoB;AAClB,QAAI,KAAK,iBAAiB;AAKxB,UAAI,CAAC,KAAK,eAAe;AACvB,yBAAiB,KAAK,iBAAiB,MAAM;AAC3C,eAAK,gBAAgB;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AAe;",
6
+ "names": []
7
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ import React from "react";
3
+ import { mergeRefs } from "../components/react-component-lib/utils";
4
+ import { IonLifeCycleContext } from "../contexts/IonLifeCycleContext";
5
+ import { StackContext } from "./StackContext";
6
+ export class PageManager extends React.PureComponent {
7
+ constructor(props) {
8
+ super(props);
9
+ this.ionPageElementRef = React.createRef();
10
+ this.stableMergedRefs = mergeRefs(this.ionPageElementRef, this.props.forwardedRef);
11
+ this.ionViewWillEnterHandler = this.ionViewWillEnterHandler.bind(this);
12
+ this.ionViewDidEnterHandler = this.ionViewDidEnterHandler.bind(this);
13
+ this.ionViewWillLeaveHandler = this.ionViewWillLeaveHandler.bind(this);
14
+ this.ionViewDidLeaveHandler = this.ionViewDidLeaveHandler.bind(this);
15
+ }
16
+ componentDidMount() {
17
+ if (this.ionPageElementRef.current) {
18
+ if (this.context.isInOutlet()) {
19
+ this.ionPageElementRef.current.classList.add("ion-page-invisible");
20
+ }
21
+ this.context.registerIonPage(this.ionPageElementRef.current, this.props.routeInfo);
22
+ this.ionPageElementRef.current.addEventListener("ionViewWillEnter", this.ionViewWillEnterHandler);
23
+ this.ionPageElementRef.current.addEventListener("ionViewDidEnter", this.ionViewDidEnterHandler);
24
+ this.ionPageElementRef.current.addEventListener("ionViewWillLeave", this.ionViewWillLeaveHandler);
25
+ this.ionPageElementRef.current.addEventListener("ionViewDidLeave", this.ionViewDidLeaveHandler);
26
+ }
27
+ }
28
+ componentWillUnmount() {
29
+ if (this.ionPageElementRef.current) {
30
+ this.ionPageElementRef.current.removeEventListener("ionViewWillEnter", this.ionViewWillEnterHandler);
31
+ this.ionPageElementRef.current.removeEventListener("ionViewDidEnter", this.ionViewDidEnterHandler);
32
+ this.ionPageElementRef.current.removeEventListener("ionViewWillLeave", this.ionViewWillLeaveHandler);
33
+ this.ionPageElementRef.current.removeEventListener("ionViewDidLeave", this.ionViewDidLeaveHandler);
34
+ }
35
+ }
36
+ ionViewWillEnterHandler() {
37
+ this.ionLifeCycleContext.ionViewWillEnter();
38
+ }
39
+ ionViewDidEnterHandler() {
40
+ this.ionLifeCycleContext.ionViewDidEnter();
41
+ }
42
+ ionViewWillLeaveHandler() {
43
+ this.ionLifeCycleContext.ionViewWillLeave();
44
+ }
45
+ ionViewDidLeaveHandler() {
46
+ this.ionLifeCycleContext.ionViewDidLeave();
47
+ }
48
+ render() {
49
+ const { className, children, routeInfo, forwardedRef, ...props } = this.props;
50
+ return /* @__PURE__ */ React.createElement(IonLifeCycleContext.Consumer, null, (context) => {
51
+ this.ionLifeCycleContext = context;
52
+ return /* @__PURE__ */ React.createElement("div", { className: className ? `${className} ion-page` : `ion-page`, ref: this.stableMergedRefs, ...props }, children);
53
+ });
54
+ }
55
+ static get contextType() {
56
+ return StackContext;
57
+ }
58
+ }
59
+ export default PageManager;
60
+ //# sourceMappingURL=PageManager.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/routing/PageManager.tsx"],
4
+ "sourcesContent": ["import React from 'react';\n\nimport { mergeRefs } from '../components/react-component-lib/utils';\nimport { IonLifeCycleContext } from '../contexts/IonLifeCycleContext';\nimport type { RouteInfo } from '../models';\n\nimport { StackContext } from './StackContext';\n\ninterface PageManagerProps {\n className?: string;\n forwardedRef?: React.ForwardedRef<HTMLDivElement>;\n routeInfo?: RouteInfo;\n}\n\nexport class PageManager extends React.PureComponent<PageManagerProps> {\n ionLifeCycleContext!: React.ContextType<typeof IonLifeCycleContext>;\n context!: React.ContextType<typeof StackContext>;\n ionPageElementRef: React.RefObject<HTMLDivElement>;\n stableMergedRefs: React.RefCallback<HTMLDivElement>;\n\n constructor(props: PageManagerProps) {\n super(props);\n this.ionPageElementRef = React.createRef();\n // React refs must be stable (not created inline).\n this.stableMergedRefs = mergeRefs(this.ionPageElementRef, this.props.forwardedRef);\n\n /**\n * This binds the scope of the following methods to the class scope.\n * The `.bind` method returns a new function, so we need to assign it\n * in the constructor rather than when adding or removing the listeners\n * to avoid creating a new function.\n */\n this.ionViewWillEnterHandler = this.ionViewWillEnterHandler.bind(this);\n this.ionViewDidEnterHandler = this.ionViewDidEnterHandler.bind(this);\n this.ionViewWillLeaveHandler = this.ionViewWillLeaveHandler.bind(this);\n this.ionViewDidLeaveHandler = this.ionViewDidLeaveHandler.bind(this);\n }\n\n componentDidMount() {\n if (this.ionPageElementRef.current) {\n if (this.context.isInOutlet()) {\n this.ionPageElementRef.current.classList.add('ion-page-invisible');\n }\n this.context.registerIonPage(this.ionPageElementRef.current, this.props.routeInfo!);\n this.ionPageElementRef.current.addEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);\n this.ionPageElementRef.current.addEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);\n this.ionPageElementRef.current.addEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);\n this.ionPageElementRef.current.addEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);\n }\n }\n\n componentWillUnmount() {\n if (this.ionPageElementRef.current) {\n this.ionPageElementRef.current.removeEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);\n this.ionPageElementRef.current.removeEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);\n this.ionPageElementRef.current.removeEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);\n this.ionPageElementRef.current.removeEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);\n }\n }\n\n ionViewWillEnterHandler() {\n this.ionLifeCycleContext.ionViewWillEnter();\n }\n\n ionViewDidEnterHandler() {\n this.ionLifeCycleContext.ionViewDidEnter();\n }\n\n ionViewWillLeaveHandler() {\n this.ionLifeCycleContext.ionViewWillLeave();\n }\n\n ionViewDidLeaveHandler() {\n this.ionLifeCycleContext.ionViewDidLeave();\n }\n\n render() {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { className, children, routeInfo, forwardedRef, ...props } = this.props;\n\n return (\n <IonLifeCycleContext.Consumer>\n {(context) => {\n this.ionLifeCycleContext = context;\n return (\n <div className={className ? `${className} ion-page` : `ion-page`} ref={this.stableMergedRefs} {...props}>\n {children}\n </div>\n );\n }}\n </IonLifeCycleContext.Consumer>\n );\n }\n\n static get contextType() {\n return StackContext;\n }\n}\nexport default PageManager;\n"],
5
+ "mappings": ";AAAA,OAAO,WAAW;AAElB,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AAGpC,SAAS,oBAAoB;AAQtB,aAAM,oBAAoB,MAAM,cAAgC;AAAA,EAMrE,YAAY,OAAyB;AACnC,UAAM,KAAK;AACX,SAAK,oBAAoB,MAAM,UAAU;AAEzC,SAAK,mBAAmB,UAAU,KAAK,mBAAmB,KAAK,MAAM,YAAY;AAQjF,SAAK,0BAA0B,KAAK,wBAAwB,KAAK,IAAI;AACrE,SAAK,yBAAyB,KAAK,uBAAuB,KAAK,IAAI;AACnE,SAAK,0BAA0B,KAAK,wBAAwB,KAAK,IAAI;AACrE,SAAK,yBAAyB,KAAK,uBAAuB,KAAK,IAAI;AAAA,EACrE;AAAA,EAEA,oBAAoB;AAClB,QAAI,KAAK,kBAAkB,SAAS;AAClC,UAAI,KAAK,QAAQ,WAAW,GAAG;AAC7B,aAAK,kBAAkB,QAAQ,UAAU,IAAI,oBAAoB;AAAA,MACnE;AACA,WAAK,QAAQ,gBAAgB,KAAK,kBAAkB,SAAS,KAAK,MAAM,SAAU;AAClF,WAAK,kBAAkB,QAAQ,iBAAiB,oBAAoB,KAAK,uBAAuB;AAChG,WAAK,kBAAkB,QAAQ,iBAAiB,mBAAmB,KAAK,sBAAsB;AAC9F,WAAK,kBAAkB,QAAQ,iBAAiB,oBAAoB,KAAK,uBAAuB;AAChG,WAAK,kBAAkB,QAAQ,iBAAiB,mBAAmB,KAAK,sBAAsB;AAAA,IAChG;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,QAAI,KAAK,kBAAkB,SAAS;AAClC,WAAK,kBAAkB,QAAQ,oBAAoB,oBAAoB,KAAK,uBAAuB;AACnG,WAAK,kBAAkB,QAAQ,o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