@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,15 @@
1
+ "use strict";
2
+ import React from "react";
3
+ export const RouteManagerContext = /* @__PURE__ */ React.createContext({
4
+ addViewItem: () => void 0,
5
+ canGoBack: () => void 0,
6
+ clearOutlet: () => void 0,
7
+ createViewItem: () => void 0,
8
+ findViewItemByPathname: () => void 0,
9
+ findLeavingViewItemByRouteInfo: () => void 0,
10
+ findViewItemByRouteInfo: () => void 0,
11
+ getChildrenToRender: () => void 0,
12
+ goBack: () => void 0,
13
+ unMountViewItem: () => void 0
14
+ });
15
+ //# sourceMappingURL=RouteManagerContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/routing/RouteManagerContext.ts"],
4
+ "sourcesContent": ["import React from 'react';\n\nimport type { RouteInfo } from '../models/RouteInfo';\n\nimport type { ViewItem } from './ViewItem';\n\nexport interface RouteManagerContextState {\n addViewItem: (viewItem: ViewItem) => void;\n canGoBack: () => boolean;\n clearOutlet: (outletId: string) => void;\n createViewItem: (\n outletId: string,\n reactElement: React.ReactElement,\n routeInfo: RouteInfo,\n page?: HTMLElement\n ) => ViewItem;\n findViewItemByPathname(pathname: string, outletId?: string): ViewItem | undefined;\n findLeavingViewItemByRouteInfo: (routeInfo: RouteInfo, outletId?: string) => ViewItem | undefined;\n findViewItemByRouteInfo: (routeInfo: RouteInfo, outletId?: string, updateMatch?: boolean) => ViewItem | undefined;\n getChildrenToRender: (\n outletId: string,\n ionRouterOutlet: React.ReactElement,\n routeInfo: RouteInfo,\n reRender: () => void\n ) => React.ReactNode[];\n goBack: () => void;\n unMountViewItem: (viewItem: ViewItem) => void;\n}\n\n// TODO(FW-2959): types\nexport const RouteManagerContext = /*@__PURE__*/ React.createContext<RouteManagerContextState>({\n addViewItem: () => undefined,\n canGoBack: () => undefined as any,\n clearOutlet: () => undefined,\n createViewItem: () => undefined as any,\n findViewItemByPathname: () => undefined,\n findLeavingViewItemByRouteInfo: () => undefined,\n findViewItemByRouteInfo: () => undefined,\n getChildrenToRender: () => undefined as any,\n goBack: () => undefined,\n unMountViewItem: () => undefined,\n});\n"],
5
+ "mappings": ";AAAA,OAAO,WAAW;AA8BX,aAAM,sBAAoC,sBAAM,cAAwC;AAAA,EAC7F,aAAa,MAAM;AAAA,EACnB,WAAW,MAAM;AAAA,EACjB,aAAa,MAAM;AAAA,EACnB,gBAAgB,MAAM;AAAA,EACtB,wBAAwB,MAAM;AAAA,EAC9B,gCAAgC,MAAM;AAAA,EACtC,yBAAyB,MAAM;AAAA,EAC/B,qBAAqB,MAAM;AAAA,EAC3B,QAAQ,MAAM;AAAA,EACd,iBAAiB,MAAM;AACzB,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ import React from "react";
3
+ export const StackContext = React.createContext({
4
+ registerIonPage: () => void 0,
5
+ isInOutlet: () => false
6
+ });
7
+ //# sourceMappingURL=StackContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/routing/StackContext.tsx"],
4
+ "sourcesContent": ["import React from 'react';\n\nimport type { RouteInfo } from '../models/RouteInfo';\n\nexport interface StackContextState {\n registerIonPage: (page: HTMLElement, routeInfo: RouteInfo) => void;\n isInOutlet: () => boolean;\n}\n\nexport const StackContext = React.createContext<StackContextState>({\n registerIonPage: () => undefined,\n isInOutlet: () => false,\n});\n"],
5
+ "mappings": ";AAAA,OAAO,WAAW;AASX,aAAM,eAAe,MAAM,cAAiC;AAAA,EACjE,iBAAiB,MAAM;AAAA,EACvB,YAAY,MAAM;AACpB,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=ViewItem.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ import React from "react";
3
+ import { DefaultIonLifeCycleContext, IonLifeCycleContext } from "../contexts/IonLifeCycleContext";
4
+ export class ViewLifeCycleManager extends React.Component {
5
+ constructor(props) {
6
+ super(props);
7
+ this.ionLifeCycleContext = new DefaultIonLifeCycleContext();
8
+ this._isMounted = false;
9
+ this.ionLifeCycleContext.onComponentCanBeDestroyed(() => {
10
+ if (!this.props.mount) {
11
+ if (this._isMounted) {
12
+ this.setState(
13
+ {
14
+ show: false
15
+ },
16
+ () => this.props.removeView()
17
+ );
18
+ }
19
+ }
20
+ });
21
+ this.state = {
22
+ show: true
23
+ };
24
+ }
25
+ componentDidMount() {
26
+ this._isMounted = true;
27
+ }
28
+ componentWillUnmount() {
29
+ this._isMounted = false;
30
+ }
31
+ render() {
32
+ const { show } = this.state;
33
+ return /* @__PURE__ */ React.createElement(IonLifeCycleContext.Provider, { value: this.ionLifeCycleContext }, show && this.props.children);
34
+ }
35
+ }
36
+ //# sourceMappingURL=ViewLifeCycleManager.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/routing/ViewLifeCycleManager.tsx"],
4
+ "sourcesContent": ["import React from 'react';\n\nimport { DefaultIonLifeCycleContext, IonLifeCycleContext } from '../contexts/IonLifeCycleContext';\n\ninterface ViewTransitionManagerProps {\n removeView: () => void;\n mount: boolean;\n}\n\ninterface ViewTransitionManagerState {\n show: boolean;\n}\n\nexport class ViewLifeCycleManager extends React.Component<ViewTransitionManagerProps, ViewTransitionManagerState> {\n ionLifeCycleContext = new DefaultIonLifeCycleContext();\n private _isMounted = false;\n\n constructor(props: ViewTransitionManagerProps) {\n super(props);\n\n this.ionLifeCycleContext.onComponentCanBeDestroyed(() => {\n if (!this.props.mount) {\n if (this._isMounted) {\n this.setState(\n {\n show: false,\n },\n () => this.props.removeView()\n );\n }\n }\n });\n\n this.state = {\n show: true,\n };\n }\n\n componentDidMount() {\n this._isMounted = true;\n }\n\n componentWillUnmount() {\n this._isMounted = false;\n }\n\n render() {\n const { show } = this.state;\n return (\n <IonLifeCycleContext.Provider value={this.ionLifeCycleContext}>\n {show && this.props.children}\n </IonLifeCycleContext.Provider>\n );\n }\n}\n"],
5
+ "mappings": ";AAAA,OAAO,WAAW;AAElB,SAAS,4BAA4B,2BAA2B;AAWzD,aAAM,6BAA6B,MAAM,UAAkE;AAAA,EAIhH,YAAY,OAAmC;AAC7C,UAAM,KAAK;AAJb,+BAAsB,IAAI,2BAA2B;AACrD,SAAQ,aAAa;AAKnB,SAAK,oBAAoB,0BAA0B,MAAM;AACvD,UAAI,CAAC,KAAK,MAAM,OAAO;AACrB,YAAI,KAAK,YAAY;AACnB,eAAK;AAAA,YACH;AAAA,cACE,MAAM;AAAA,YACR;AAAA,YACA,MAAM,KAAK,MAAM,WAAW;AAAA,UAC9B;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,SAAK,QAAQ;AAAA,MACX,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,oBAAoB;AAClB,SAAK,aAAa;AAAA,EACpB;AAAA,EAEA,uBAAuB;AACrB,SAAK,aAAa;AAAA,EACpB;AAAA,EAEA,SAAS;AACP,UAAM,EAAE,KAAK,IAAI,KAAK;AACtB,WACE,oCAAC,oBAAoB,UAApB,EAA6B,OAAO,KAAK,uBACvC,QAAQ,KAAK,MAAM,QACtB;AAAA,EAEJ;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ export class ViewStacks {
3
+ constructor() {
4
+ this.viewStacks = {};
5
+ this.add = this.add.bind(this);
6
+ this.clear = this.clear.bind(this);
7
+ this.getViewItemsForOutlet = this.getViewItemsForOutlet.bind(this);
8
+ this.remove = this.remove.bind(this);
9
+ }
10
+ add(viewItem) {
11
+ const { outletId } = viewItem;
12
+ if (!this.viewStacks[outletId]) {
13
+ this.viewStacks[outletId] = [viewItem];
14
+ } else {
15
+ this.viewStacks[outletId].push(viewItem);
16
+ }
17
+ }
18
+ clear(outletId) {
19
+ return setTimeout(() => {
20
+ delete this.viewStacks[outletId];
21
+ }, 500);
22
+ }
23
+ getViewItemsForOutlet(outletId) {
24
+ return this.viewStacks[outletId] || [];
25
+ }
26
+ remove(viewItem) {
27
+ const { outletId } = viewItem;
28
+ const viewStack = this.viewStacks[outletId];
29
+ if (viewStack) {
30
+ const viewItemToRemove = viewStack.find((x) => x.id === viewItem.id);
31
+ if (viewItemToRemove) {
32
+ viewItemToRemove.mount = false;
33
+ this.viewStacks[outletId] = viewStack.filter((x) => x.id !== viewItemToRemove.id);
34
+ }
35
+ }
36
+ }
37
+ getStackIds() {
38
+ return Object.keys(this.viewStacks);
39
+ }
40
+ getAllViewItems() {
41
+ const keys = this.getStackIds();
42
+ const viewItems = [];
43
+ keys.forEach((k) => {
44
+ viewItems.push(...this.viewStacks[k]);
45
+ });
46
+ return viewItems;
47
+ }
48
+ }
49
+ //# sourceMappingURL=ViewStacks.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/routing/ViewStacks.ts"],
4
+ "sourcesContent": ["import type { RouteInfo } from '../models/RouteInfo';\n\nimport type { ViewItem } from './ViewItem';\n\nexport abstract class ViewStacks {\n private viewStacks: { [key: string]: ViewItem[] } = {};\n\n constructor() {\n this.add = this.add.bind(this);\n this.clear = this.clear.bind(this);\n this.getViewItemsForOutlet = this.getViewItemsForOutlet.bind(this);\n this.remove = this.remove.bind(this);\n }\n\n add(viewItem: ViewItem) {\n const { outletId } = viewItem;\n if (!this.viewStacks[outletId]) {\n this.viewStacks[outletId] = [viewItem];\n } else {\n this.viewStacks[outletId].push(viewItem);\n }\n }\n\n clear(outletId: string) {\n // Give some time for the leaving views to transition before removing\n return setTimeout(() => {\n delete this.viewStacks[outletId];\n }, 500);\n }\n\n getViewItemsForOutlet(outletId: string) {\n return this.viewStacks[outletId] || [];\n }\n\n remove(viewItem: ViewItem) {\n const { outletId } = viewItem;\n const viewStack = this.viewStacks[outletId];\n if (viewStack) {\n const viewItemToRemove = viewStack.find((x) => x.id === viewItem.id);\n if (viewItemToRemove) {\n viewItemToRemove.mount = false;\n this.viewStacks[outletId] = viewStack.filter((x) => x.id !== viewItemToRemove.id);\n }\n }\n }\n\n protected getStackIds() {\n return Object.keys(this.viewStacks);\n }\n\n protected getAllViewItems() {\n const keys = this.getStackIds();\n const viewItems: ViewItem[] = [];\n keys.forEach((k) => {\n viewItems.push(...this.viewStacks[k]);\n });\n return viewItems;\n }\n\n abstract createViewItem(\n outletId: string,\n reactElement: React.ReactElement,\n routeInfo: RouteInfo,\n page?: HTMLElement\n ): ViewItem;\n abstract findViewItemByPathname(pathname: string, outletId?: string): ViewItem | undefined;\n abstract findViewItemByRouteInfo(\n routeInfo: RouteInfo,\n outletId?: string,\n updateMatch?: boolean\n ): ViewItem | undefined;\n abstract findLeavingViewItemByRouteInfo(routeInfo: RouteInfo, outletId?: string): ViewItem | undefined;\n abstract getChildrenToRender(\n outletId: string,\n ionRouterOutlet: React.ReactElement,\n routeInfo: RouteInfo,\n reRender: () => void,\n setInTransition: () => void\n ): React.ReactNode[];\n}\n"],
5
+ "mappings": ";AAIO,aAAe,WAAW;AAAA,EAG/B,cAAc;AAFd,SAAQ,aAA4C,CAAC;AAGnD,SAAK,MAAM,KAAK,IAAI,KAAK,IAAI;AAC7B,SAAK,QAAQ,KAAK,MAAM,KAAK,IAAI;AACjC,SAAK,wBAAwB,KAAK,sBAAsB,KAAK,IAAI;AACjE,SAAK,SAAS,KAAK,OAAO,KAAK,IAAI;AAAA,EACrC;AAAA,EAEA,IAAI,UAAoB;AACtB,UAAM,EAAE,SAAS,IAAI;AACrB,QAAI,CAAC,KAAK,WAAW,QAAQ,GAAG;AAC9B,WAAK,WAAW,QAAQ,IAAI,CAAC,QAAQ;AAAA,IACvC,OAAO;AACL,WAAK,WAAW,QAAQ,EAAE,KAAK,QAAQ;AAAA,IACzC;AAAA,EACF;AAAA,EAEA,MAAM,UAAkB;AAEtB,WAAO,WAAW,MAAM;AACtB,aAAO,KAAK,WAAW,QAAQ;AAAA,IACjC,GAAG,GAAG;AAAA,EACR;AAAA,EAEA,sBAAsB,UAAkB;AACtC,WAAO,KAAK,WAAW,QAAQ,KAAK,CAAC;AAAA,EACvC;AAAA,EAEA,OAAO,UAAoB;AACzB,UAAM,EAAE,SAAS,IAAI;AACrB,UAAM,YAAY,KAAK,WAAW,QAAQ;AAC1C,QAAI,WAAW;AACb,YAAM,mBAAmB,UAAU,KAAK,CAAC,MAAM,EAAE,OAAO,SAAS,EAAE;AACnE,UAAI,kBAAkB;AACpB,yBAAiB,QAAQ;AACzB,aAAK,WAAW,QAAQ,IAAI,UAAU,OAAO,CAAC,MAAM,EAAE,OAAO,iBAAiB,EAAE;AAAA,MAClF;AAAA,IACF;AAAA,EACF;AAAA,EAEU,cAAc;AACtB,WAAO,OAAO,KAAK,KAAK,UAAU;AAAA,EACpC;AAAA,EAEU,kBAAkB;AAC1B,UAAM,OAAO,KAAK,YAAY;AAC9B,UAAM,YAAwB,CAAC;AAC/B,SAAK,QAAQ,CAAC,MAAM;AAClB,gBAAU,KAAK,GAAG,KAAK,WAAW,CAAC,CAAC;AAAA,IACtC,CAAC;AACD,WAAO;AAAA,EACT;AAsBF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ import { LocationHistory } from "../LocationHistory";
3
+ import { generateId } from "../../utils/generateId";
4
+ let log = false;
5
+ describe("LocationHistory", () => {
6
+ let locationHistory;
7
+ logHistory();
8
+ log = true;
9
+ beforeEach(() => {
10
+ locationHistory = new LocationHistory();
11
+ });
12
+ describe("Popping history", () => {
13
+ describe("page1 > page2", () => {
14
+ beforeEach(() => {
15
+ const firstRoute = createRoute("/page1");
16
+ const secondRoute = createRoute("/page2", firstRoute);
17
+ locationHistory.add(firstRoute);
18
+ locationHistory.add(secondRoute);
19
+ });
20
+ it("then should be at /page2 canGoBack should be true", () => {
21
+ expect(currentRoute().pathname).toEqual("/page2");
22
+ expect(locationHistory.canGoBack()).toBeTruthy();
23
+ });
24
+ it("when going back, should be on /page1 and canGoBack should be false", () => {
25
+ popRoute();
26
+ expect(currentRoute().pathname).toEqual("/page1");
27
+ expect(locationHistory.canGoBack()).toBeFalsy();
28
+ });
29
+ });
30
+ describe("tab1 > tab2 > Back", () => {
31
+ beforeEach(() => {
32
+ const tab1Route = createRoute("/tab1", void 0, "tab1");
33
+ const tab2Route = createRoute("/tab2", tab1Route, "tab2");
34
+ locationHistory.add(tab1Route);
35
+ locationHistory.add(tab2Route);
36
+ popRoute();
37
+ });
38
+ it("then should be on tab1 and should not be able to go back", () => {
39
+ expect(currentRoute().pathname).toEqual("/tab1");
40
+ expect(locationHistory.canGoBack()).toBeFalsy();
41
+ });
42
+ });
43
+ describe("tab1 > tab2 > tab3", () => {
44
+ beforeEach(() => {
45
+ const tab1Route = createRoute("/tab1", void 0, "tab1");
46
+ const tab2Route = createRoute("/tab2", tab1Route, "tab2");
47
+ const tab3Route = createRoute("/tab3", tab2Route, "tab3");
48
+ locationHistory.add(tab1Route);
49
+ locationHistory.add(tab2Route);
50
+ locationHistory.add(tab3Route);
51
+ });
52
+ it("when back once, then should be on tab2 and should be able to go back", () => {
53
+ popRoute();
54
+ expect(currentRoute().pathname).toEqual("/tab2");
55
+ expect(locationHistory.canGoBack).toBeTruthy();
56
+ });
57
+ it("when going back twice, should be on tab1 and not be able to go back", () => {
58
+ popRoute();
59
+ popRoute();
60
+ expect(currentRoute().pathname).toEqual("/tab1");
61
+ expect(locationHistory.canGoBack()).toBeFalsy();
62
+ });
63
+ });
64
+ describe("tab1 > tab1/details/1, then tab1/details/2", () => {
65
+ beforeEach(() => {
66
+ const homeRoute = createRoute("/tab1", void 0, "tab1");
67
+ const details1Route = createRoute("/tab1/details/1", void 0, "tab1");
68
+ const details2Route = createRoute("/tab1/details/2", void 0, "tab1");
69
+ locationHistory.add(homeRoute);
70
+ locationHistory.add(details1Route);
71
+ locationHistory.add(details2Route);
72
+ });
73
+ it("then should be at details2 and able to go back", () => {
74
+ expect(currentRoute().pathname).toEqual("/tab1/details/2");
75
+ expect(locationHistory.canGoBack()).toBeTruthy();
76
+ });
77
+ it("when going back, should be at details1 and able to go back", () => {
78
+ popRoute();
79
+ expect(currentRoute().pathname).toEqual("/tab1/details/1");
80
+ expect(locationHistory.canGoBack()).toBeTruthy();
81
+ });
82
+ it("when going back twice, should be at home and not able to go back", () => {
83
+ popRoute();
84
+ popRoute();
85
+ expect(currentRoute().pathname).toEqual("/tab1");
86
+ expect(locationHistory.canGoBack()).toBeFalsy();
87
+ });
88
+ });
89
+ });
90
+ describe("Switching tabs", () => {
91
+ describe("tab1 > tab2 > tab1", () => {
92
+ beforeEach(() => {
93
+ const tab1Route = createRoute("/tab1", void 0, "tab1");
94
+ const tab2Route = createRoute("/tab2", tab1Route, "tab2");
95
+ const tab1_2Route = createRoute("/tab1", tab2Route, "tab1");
96
+ locationHistory.add(tab1Route);
97
+ locationHistory.add(tab2Route);
98
+ locationHistory.add(tab1_2Route);
99
+ });
100
+ it("then locationHistory should have 3 entries", () => expect(locationHistory.locationHistory.length).toEqual(3));
101
+ it("then tab1 and tab2 should have one entry", () => {
102
+ expect(locationHistory.tabHistory["tab1"].length).toEqual(1);
103
+ expect(locationHistory.tabHistory["tab2"].length).toEqual(1);
104
+ });
105
+ });
106
+ describe("tab1 > tab2 > tab3 > Back", () => {
107
+ beforeEach(() => {
108
+ const tab1Route = createRoute("/tab1", void 0, "tab1");
109
+ const tab2Route = createRoute("/tab2", tab1Route, "tab2");
110
+ const tab3Route = createRoute("/tab3", tab2Route, "tab3");
111
+ locationHistory.add(tab1Route);
112
+ locationHistory.add(tab2Route);
113
+ locationHistory.add(tab3Route);
114
+ popRoute();
115
+ });
116
+ it("when going back, then locationHistory should have 2 entries", () => {
117
+ expect(locationHistory.locationHistory.length).toEqual(2);
118
+ });
119
+ it("when going back, then tab1, tab2, and tab3 should have one entry", () => {
120
+ expect(locationHistory.tabHistory["tab1"].length).toEqual(1);
121
+ expect(locationHistory.tabHistory["tab2"].length).toEqual(1);
122
+ expect(locationHistory.tabHistory["tab3"].length).toEqual(1);
123
+ });
124
+ });
125
+ });
126
+ describe("Replacing history", () => {
127
+ describe("tab1 > tab1/details/1, tab1/details/2, Replace to tab1/details/3", () => {
128
+ beforeEach(() => {
129
+ const homeRoute = createRoute("/tab1", void 0, "tab1");
130
+ const details1Route = createRoute("/tab1/details/1", homeRoute, "tab1");
131
+ const details2Route = createRoute("/tab1/details/2", details1Route, "tab1");
132
+ const details3Route = createRoute("/tab1/details/3", details2Route, "tab1", "replace");
133
+ locationHistory.add(homeRoute);
134
+ locationHistory.add(details1Route);
135
+ locationHistory.add(details2Route);
136
+ locationHistory.add(details3Route);
137
+ });
138
+ it("then should be at details3", () => {
139
+ expect(currentRoute().pathname).toEqual("/tab1/details/3");
140
+ });
141
+ it("tab1 history should have 3 entries and they should have correct paths", () => {
142
+ expect(locationHistory.tabHistory["tab1"].length).toEqual(3);
143
+ expect(locationHistory.tabHistory["tab1"][0].pathname).toEqual("/tab1");
144
+ expect(locationHistory.tabHistory["tab1"][1].pathname).toEqual("/tab1/details/1");
145
+ expect(locationHistory.tabHistory["tab1"][2].pathname).toEqual("/tab1/details/3");
146
+ });
147
+ it("locationHistory should have 3 entries and they should have correct paths", () => {
148
+ expect(locationHistory.locationHistory.length).toEqual(3);
149
+ expect(locationHistory.locationHistory[0].pathname).toEqual("/tab1");
150
+ expect(locationHistory.locationHistory[1].pathname).toEqual("/tab1/details/1");
151
+ expect(locationHistory.locationHistory[2].pathname).toEqual("/tab1/details/3");
152
+ });
153
+ });
154
+ });
155
+ function currentRoute() {
156
+ return locationHistory.current();
157
+ }
158
+ function popRoute() {
159
+ const previous = locationHistory.previous();
160
+ previous.routeDirection = "back";
161
+ previous.routeAction = "pop";
162
+ locationHistory.add(previous);
163
+ }
164
+ function logHistory() {
165
+ if (log) {
166
+ console.log("locationHistory", locationHistory.locationHistory);
167
+ console.log("tabHistory", locationHistory.tabHistory);
168
+ }
169
+ }
170
+ });
171
+ function createRoute(pathname = "", prevRoute, tab, routeAction = "push") {
172
+ const routeInfo = {
173
+ id: generateId(),
174
+ lastPathname: prevRoute?.pathname,
175
+ prevRouteLastPathname: prevRoute?.lastPathname,
176
+ routeAction,
177
+ routeDirection: "forward",
178
+ pushedByRoute: prevRoute?.pathname,
179
+ pathname,
180
+ tab,
181
+ search: ""
182
+ };
183
+ return routeInfo;
184
+ }
185
+ //# sourceMappingURL=LocationHistory.spec.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/routing/__tests__/LocationHistory.spec.ts"],
4
+ "sourcesContent": ["import { LocationHistory } from '../LocationHistory';\nimport { RouteInfo } from '../../models/RouteInfo';\nimport { generateId } from '../../utils/generateId';\n\nlet log = false;\n\ndescribe('LocationHistory', () => {\n let locationHistory: LocationHistory;\n logHistory();\n log = true;\n\n beforeEach(() => {\n locationHistory = new LocationHistory();\n });\n\n describe('Popping history', () => {\n describe('page1 > page2', () => {\n beforeEach(() => {\n const firstRoute = createRoute('/page1');\n const secondRoute = createRoute('/page2', firstRoute);\n locationHistory.add(firstRoute);\n locationHistory.add(secondRoute);\n });\n\n it('then should be at /page2 canGoBack should be true', () => {\n expect(currentRoute().pathname).toEqual('/page2');\n expect(locationHistory.canGoBack()).toBeTruthy();\n });\n\n it('when going back, should be on /page1 and canGoBack should be false', () => {\n popRoute();\n expect(currentRoute().pathname).toEqual('/page1');\n expect(locationHistory.canGoBack()).toBeFalsy();\n });\n });\n\n describe('tab1 > tab2 > Back', () => {\n beforeEach(() => {\n const tab1Route = createRoute('/tab1', undefined, 'tab1');\n const tab2Route = createRoute('/tab2', tab1Route, 'tab2');\n locationHistory.add(tab1Route);\n locationHistory.add(tab2Route);\n popRoute();\n });\n\n it('then should be on tab1 and should not be able to go back', () => {\n expect(currentRoute().pathname).toEqual('/tab1');\n expect(locationHistory.canGoBack()).toBeFalsy();\n });\n });\n\n describe('tab1 > tab2 > tab3', () => {\n beforeEach(() => {\n const tab1Route = createRoute('/tab1', undefined, 'tab1');\n const tab2Route = createRoute('/tab2', tab1Route, 'tab2');\n const tab3Route = createRoute('/tab3', tab2Route, 'tab3');\n locationHistory.add(tab1Route);\n locationHistory.add(tab2Route);\n locationHistory.add(tab3Route);\n });\n\n it('when back once, then should be on tab2 and should be able to go back', () => {\n popRoute();\n expect(currentRoute().pathname).toEqual('/tab2');\n expect(locationHistory.canGoBack).toBeTruthy();\n });\n\n it('when going back twice, should be on tab1 and not be able to go back', () => {\n popRoute();\n popRoute();\n expect(currentRoute().pathname).toEqual('/tab1');\n expect(locationHistory.canGoBack()).toBeFalsy();\n });\n });\n\n describe('tab1 > tab1/details/1, then tab1/details/2', () => {\n beforeEach(() => {\n const homeRoute = createRoute('/tab1', undefined, 'tab1');\n const details1Route = createRoute('/tab1/details/1', undefined, 'tab1');\n const details2Route = createRoute('/tab1/details/2', undefined, 'tab1');\n locationHistory.add(homeRoute);\n locationHistory.add(details1Route);\n locationHistory.add(details2Route);\n });\n\n it('then should be at details2 and able to go back', () => {\n expect(currentRoute().pathname).toEqual('/tab1/details/2');\n expect(locationHistory.canGoBack()).toBeTruthy();\n });\n\n it('when going back, should be at details1 and able to go back', () => {\n popRoute();\n expect(currentRoute().pathname).toEqual('/tab1/details/1');\n expect(locationHistory.canGoBack()).toBeTruthy();\n });\n\n it('when going back twice, should be at home and not able to go back', () => {\n popRoute();\n popRoute();\n expect(currentRoute().pathname).toEqual('/tab1');\n expect(locationHistory.canGoBack()).toBeFalsy();\n });\n });\n });\n\n describe('Switching tabs', () => {\n describe('tab1 > tab2 > tab1', () => {\n beforeEach(() => {\n const tab1Route = createRoute('/tab1', undefined, 'tab1');\n const tab2Route = createRoute('/tab2', tab1Route, 'tab2');\n const tab1_2Route = createRoute('/tab1', tab2Route, 'tab1');\n locationHistory.add(tab1Route);\n locationHistory.add(tab2Route);\n locationHistory.add(tab1_2Route);\n });\n\n it('then locationHistory should have 3 entries', () =>\n expect((locationHistory as any).locationHistory.length).toEqual(3));\n\n it('then tab1 and tab2 should have one entry', () => {\n expect((locationHistory as any).tabHistory['tab1'].length).toEqual(1);\n expect((locationHistory as any).tabHistory['tab2'].length).toEqual(1);\n });\n });\n\n describe('tab1 > tab2 > tab3 > Back', () => {\n beforeEach(() => {\n const tab1Route = createRoute('/tab1', undefined, 'tab1');\n const tab2Route = createRoute('/tab2', tab1Route, 'tab2');\n const tab3Route = createRoute('/tab3', tab2Route, 'tab3');\n locationHistory.add(tab1Route);\n locationHistory.add(tab2Route);\n locationHistory.add(tab3Route);\n popRoute();\n });\n\n it('when going back, then locationHistory should have 2 entries', () => {\n expect((locationHistory as any).locationHistory.length).toEqual(2);\n });\n\n it('when going back, then tab1, tab2, and tab3 should have one entry', () => {\n expect((locationHistory as any).tabHistory['tab1'].length).toEqual(1);\n expect((locationHistory as any).tabHistory['tab2'].length).toEqual(1);\n expect((locationHistory as any).tabHistory['tab3'].length).toEqual(1);\n });\n });\n });\n\n describe('Replacing history', () => {\n describe('tab1 > tab1/details/1, tab1/details/2, Replace to tab1/details/3', () => {\n beforeEach(() => {\n const homeRoute = createRoute('/tab1', undefined, 'tab1');\n const details1Route = createRoute('/tab1/details/1', homeRoute, 'tab1');\n const details2Route = createRoute('/tab1/details/2', details1Route, 'tab1');\n const details3Route = createRoute('/tab1/details/3', details2Route, 'tab1', 'replace');\n locationHistory.add(homeRoute);\n locationHistory.add(details1Route);\n locationHistory.add(details2Route);\n locationHistory.add(details3Route);\n });\n\n it('then should be at details3', () => {\n expect(currentRoute().pathname).toEqual('/tab1/details/3');\n });\n\n it('tab1 history should have 3 entries and they should have correct paths', () => {\n expect((locationHistory as any).tabHistory['tab1'].length).toEqual(3);\n expect((locationHistory as any).tabHistory['tab1'][0].pathname).toEqual('/tab1');\n expect((locationHistory as any).tabHistory['tab1'][1].pathname).toEqual('/tab1/details/1');\n expect((locationHistory as any).tabHistory['tab1'][2].pathname).toEqual('/tab1/details/3');\n });\n\n it('locationHistory should have 3 entries and they should have correct paths', () => {\n expect((locationHistory as any).locationHistory.length).toEqual(3);\n expect((locationHistory as any).locationHistory[0].pathname).toEqual('/tab1');\n expect((locationHistory as any).locationHistory[1].pathname).toEqual('/tab1/details/1');\n expect((locationHistory as any).locationHistory[2].pathname).toEqual('/tab1/details/3');\n });\n });\n });\n\n function currentRoute() {\n return locationHistory.current();\n }\n\n function popRoute() {\n const previous = locationHistory.previous();\n previous.routeDirection = 'back';\n previous.routeAction = 'pop';\n locationHistory.add(previous);\n }\n\n function logHistory() {\n if (log) {\n console.log('locationHistory', (locationHistory as any).locationHistory);\n console.log('tabHistory', (locationHistory as any).tabHistory);\n }\n }\n});\n\nfunction createRoute(pathname: string = '', prevRoute?: RouteInfo, tab?: string, routeAction = 'push') {\n const routeInfo: RouteInfo = {\n id: generateId(),\n lastPathname: prevRoute?.pathname,\n prevRouteLastPathname: prevRoute?.lastPathname,\n routeAction: routeAction as any,\n routeDirection: 'forward',\n pushedByRoute: prevRoute?.pathname,\n pathname: pathname,\n tab: tab,\n search: '',\n };\n return routeInfo;\n}\n"],
5
+ "mappings": ";AAAA,SAAS,uBAAuB;AAEhC,SAAS,kBAAkB;AAE3B,IAAI,MAAM;AAEV,SAAS,mBAAmB,MAAM;AAChC,MAAI;AACJ,aAAW;AACX,QAAM;AAEN,aAAW,MAAM;AACf,sBAAkB,IAAI,gBAAgB;AAAA,EACxC,CAAC;AAED,WAAS,mBAAmB,MAAM;AAChC,aAAS,iBAAiB,MAAM;AAC9B,iBAAW,MAAM;AACf,cAAM,aAAa,YAAY,QAAQ;AACvC,cAAM,cAAc,YAAY,UAAU,UAAU;AACpD,wBAAgB,IAAI,UAAU;AAC9B,wBAAgB,IAAI,WAAW;AAAA,MACjC,CAAC;AAED,SAAG,qDAAqD,MAAM;AAC5D,eAAO,aAAa,EAAE,QAAQ,EAAE,QAAQ,QAAQ;AAChD,eAAO,gBAAgB,UAAU,CAAC,EAAE,WAAW;AAAA,MACjD,CAAC;AAED,SAAG,sEAAsE,MAAM;AAC7E,iBAAS;AACT,eAAO,aAAa,EAAE,QAAQ,EAAE,QAAQ,QAAQ;AAChD,eAAO,gBAAgB,UAAU,CAAC,EAAE,UAAU;AAAA,MAChD,CAAC;AAAA,IACH,CAAC;AAED,aAAS,sBAAsB,MAAM;AACnC,iBAAW,MAAM;AACf,cAAM,YAAY,YAAY,SAAS,QAAW,MAAM;AACxD,cAAM,YAAY,YAAY,SAAS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AG,4EAA4E,MAAM;AACnF,eAAQ,gBAAwB,gBAAgB,MAAM,EAAE,QAAQ,CAAC;AACjE,eAAQ,gBAAwB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,QAAQ,OAAO;AAC5E,eAAQ,gBAAwB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,QAAQ,iBAAiB;AACtF,eAAQ,gBAAwB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,QAAQ,iBAAiB;AAAA,MACxF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AAED,WAAS,eAAe;AACtB,WAAO,gBAAgB,QAAQ;AAAA,EACjC;AAEA,WAAS,WAAW;AAClB,UAAM,WAAW,gBAAgB,SAAS;AAC1C,aAAS,iBAAiB;AAC1B,aAAS,cAAc;AACvB,oBAAgB,IAAI,QAAQ;AAAA,EAC9B;AAEA,WAAS,aAAa;AACpB,QAAI,KAAK;AACP,cAAQ,IAAI,mBAAoB,gBAAwB,eAAe;AACvE,cAAQ,IAAI,cAAe,gBAAwB,UAAU;AAAA,IAC/D;AAAA,EACF;AACF,CAAC;AAED,SAAS,YAAY,WAAmB,IAAI,WAAuB,KAAc,cAAc,QAAQ;AACrG,QAAM,YAAuB;AAAA,IAC3B,IAAI,WAAW;AAAA,IACf,cAAc,WAAW;AAAA,IACzB,uBAAuB,WAAW;AAAA,IAClC;AAAA,IACA,gBAAgB;AAAA,IAChB,eAAe,WAAW;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV;AACA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ export * from "./RouteManagerContext";
3
+ export * from "./ViewLifeCycleManager";
4
+ export * from "./LocationHistory";
5
+ export * from "./NavManager";
6
+ export * from "./ViewItem";
7
+ export * from "./StackContext";
8
+ export * from "./ViewStacks";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/routing/index.ts"],
4
+ "sourcesContent": ["export * from './RouteManagerContext';\nexport * from './ViewLifeCycleManager';\nexport * from './LocationHistory';\nexport * from './NavManager';\nexport * from './ViewItem';\nexport * from './StackContext';\nexport * from './ViewStacks';\n"],
5
+ "mappings": ";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ export const HTMLElementSSR = typeof HTMLElement !== "undefined" ? HTMLElement : class {
3
+ };
4
+ //# sourceMappingURL=HTMLElementSSR.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/HTMLElementSSR.ts"],
4
+ "sourcesContent": ["export const HTMLElementSSR = (typeof HTMLElement !== 'undefined' ? HTMLElement : class {}) as typeof HTMLElement;\n"],
5
+ "mappings": ";AAAO,aAAM,iBAAkB,OAAO,gBAAgB,cAAc,cAAc,MAAM;AAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ const ids = { main: 0 };
3
+ export const generateId = (type = "main") => {
4
+ const id = (ids[type] ?? 0) + 1;
5
+ ids[type] = id;
6
+ return id.toString();
7
+ };
8
+ //# sourceMappingURL=generateId.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/generateId.ts"],
4
+ "sourcesContent": ["const ids: { [key: string]: number } = { main: 0 };\n\nexport const generateId = (type = 'main') => {\n const id = (ids[type] ?? 0) + 1;\n ids[type] = id;\n return id.toString();\n};\n"],
5
+ "mappings": ";AAAA,MAAM,MAAiC,EAAE,MAAM,EAAE;AAE1C,aAAM,aAAa,CAAC,OAAO,WAAW;AAC3C,QAAM,MAAM,IAAI,IAAI,KAAK,KAAK;AAC9B,MAAI,IAAI,IAAI;AACZ,SAAO,GAAG,SAAS;AACrB;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionic/react",
3
- "version": "7.5.3-dev.11698856380.18896dcd",
3
+ "version": "7.5.3-dev.11698858201.14165f23",
4
4
  "description": "React specific wrapper for @ionic/core",
5
5
  "keywords": [
6
6
  "ionic",
@@ -20,18 +20,15 @@
20
20
  "url": "git+https://github.com/ionic-team/ionic-framework.git"
21
21
  },
22
22
  "scripts": {
23
- "build": "npm run clean && npm run copy && npm run compile",
24
- "clean": "rimraf dist && rimraf dist-transpiled && rimraf routing",
25
- "compile": "npm run tsc && rollup -c",
23
+ "build": "npm run copy && npm run compile",
24
+ "compile": "node ./esbuild.mjs",
26
25
  "eslint": "eslint src",
27
26
  "prettier": "prettier \"./src/**/*.{html,ts,tsx,js,jsx}\"",
28
27
  "release": "np --any-branch --yolo --no-release-draft",
29
28
  "lint": "npm run eslint && npm run prettier -- --write --cache",
30
29
  "lint.fix": "npm run eslint -- --fix && npm run prettier -- --write --cache",
31
- "tsc": "tsc -p .",
32
30
  "copy": "node scripts/copy.js",
33
31
  "test.spec": "jest --ci",
34
- "test.treeshake": "node scripts/treeshaking.js dist/index.esm.js",
35
32
  "sync": "sh ./scripts/sync.sh"
36
33
  },
37
34
  "main": "dist/index.js",
@@ -41,7 +38,7 @@
41
38
  "css/"
42
39
  ],
43
40
  "dependencies": {
44
- "@ionic/core": "7.5.3-dev.11698856380.18896dcd",
41
+ "@ionic/core": "7.5.3-dev.11698858201.14165f23",
45
42
  "ionicons": "^7.0.0",
46
43
  "tslib": "*"
47
44
  },
@@ -52,8 +49,6 @@
52
49
  "devDependencies": {
53
50
  "@ionic/eslint-config": "^0.3.0",
54
51
  "@ionic/prettier-config": "^2.0.0",
55
- "@rollup/plugin-node-resolve": "^8.1.0",
56
- "@rollup/plugin-virtual": "^2.0.3",
57
52
  "@testing-library/jest-dom": "^5.11.6",
58
53
  "@testing-library/react": "^11.2.2",
59
54
  "@testing-library/react-hooks": "^7.0.1",
@@ -63,6 +58,7 @@
63
58
  "@types/react-dom": "^16.9.0",
64
59
  "@typescript-eslint/eslint-plugin": "^5.48.2",
65
60
  "@typescript-eslint/parser": "^5.48.2",
61
+ "esbuild": "^0.19.5",
66
62
  "eslint": "^7.32.0",
67
63
  "fs-extra": "^9.0.1",
68
64
  "jest": "^26.6.3",
@@ -70,9 +66,6 @@
70
66
  "prettier": "^2.8.3",
71
67
  "react": "^16.9.0",
72
68
  "react-dom": "^16.9.0",
73
- "rimraf": "^3.0.2",
74
- "rollup": "^2.26.4",
75
- "rollup-plugin-sourcemaps": "^0.6.2",
76
69
  "ts-jest": "^26.4.4",
77
70
  "typescript": "^4.0.5"
78
71
  },
@@ -1,71 +0,0 @@
1
- import type { Animation, AnimationCallbackOptions, AnimationDirection, AnimationFill, AnimationKeyFrames, AnimationLifecycle } from '@ionic/core/components';
2
- import type { PropsWithChildren } from 'react';
3
- import React from 'react';
4
- interface PartialPropertyValue {
5
- property: string;
6
- value: any;
7
- }
8
- interface PropertyValue {
9
- property: string;
10
- fromValue: any;
11
- toValue: any;
12
- }
13
- export interface CreateAnimationProps {
14
- delay?: number;
15
- direction?: AnimationDirection;
16
- duration?: number;
17
- easing?: string;
18
- fill?: AnimationFill;
19
- iterations?: number;
20
- id?: string;
21
- afterAddRead?: () => void;
22
- afterAddWrite?: () => void;
23
- afterClearStyles?: string[];
24
- afterStyles?: {
25
- [property: string]: any;
26
- };
27
- afterAddClass?: string | string[];
28
- afterRemoveClass?: string | string[];
29
- beforeAddRead?: () => void;
30
- beforeAddWrite?: () => void;
31
- beforeClearStyles?: string[];
32
- beforeStyles?: {
33
- [property: string]: any;
34
- };
35
- beforeAddClass?: string | string[];
36
- beforeRemoveClass?: string | string[];
37
- onFinish?: {
38
- callback: AnimationLifecycle;
39
- opts?: AnimationCallbackOptions;
40
- };
41
- keyframes?: AnimationKeyFrames;
42
- from?: PartialPropertyValue[] | PartialPropertyValue;
43
- to?: PartialPropertyValue[] | PartialPropertyValue;
44
- fromTo?: PropertyValue[] | PropertyValue;
45
- play?: boolean;
46
- pause?: boolean;
47
- stop?: boolean;
48
- destroy?: boolean;
49
- progressStart?: {
50
- forceLinearEasing: boolean;
51
- step?: number;
52
- };
53
- progressStep?: {
54
- step: number;
55
- };
56
- progressEnd?: {
57
- playTo: 0 | 1 | undefined;
58
- step: number;
59
- dur?: number;
60
- };
61
- }
62
- export declare class CreateAnimation extends React.PureComponent<PropsWithChildren<CreateAnimationProps>> {
63
- nodes: Map<number, HTMLElement>;
64
- animation: Animation;
65
- constructor(props: any);
66
- setupAnimation(props: any): void;
67
- componentDidMount(): void;
68
- componentDidUpdate(prevProps: any): void;
69
- render(): JSX.Element;
70
- }
71
- export {};
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import type { JSX } from '@ionic/core/components';
3
- export declare const IonActionSheet: import("react").ForwardRefExoticComponent<JSX.IonActionSheet & Omit<import("react").HTMLAttributes<HTMLIonActionSheetElement>, "style"> & import("./IonicReactProps").IonicReactProps & import("react").RefAttributes<HTMLIonActionSheetElement>>;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import type { JSX } from '@ionic/core/components';
3
- export declare const IonAlert: import("react").ForwardRefExoticComponent<JSX.IonAlert & Omit<import("react").HTMLAttributes<HTMLIonAlertElement>, "style"> & import("./IonicReactProps").IonicReactProps & import("react").RefAttributes<HTMLIonAlertElement>>;
@@ -1,41 +0,0 @@
1
- import type { JSX as LocalJSX } from '@ionic/core/components';
2
- import React from 'react';
3
- import type { IonContextInterface } from '../contexts/IonContext';
4
- import type { ReactComponentOrElement } from '../models';
5
- import type { IonicReactProps } from './IonicReactProps';
6
- type Props = LocalJSX.IonApp & IonicReactProps & {
7
- ref?: React.Ref<HTMLIonAppElement>;
8
- };
9
- export declare const IonApp: {
10
- new (props: Props): {
11
- addOverlayCallback?: ((id: string, overlay: ReactComponentOrElement, containerElement: HTMLDivElement) => void) | undefined;
12
- removeOverlayCallback?: ((id: string) => void) | undefined;
13
- ionContext: IonContextInterface;
14
- render(): JSX.Element;
15
- context: any;
16
- setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Props>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
17
- forceUpdate(callback?: (() => void) | undefined): void;
18
- readonly props: Readonly<Props> & Readonly<{
19
- children?: React.ReactNode;
20
- }>;
21
- state: Readonly<{}>;
22
- refs: {
23
- [key: string]: React.ReactInstance;
24
- };
25
- componentDidMount?(): void;
26
- shouldComponentUpdate?(nextProps: Readonly<Props>, nextState: Readonly<{}>, nextContext: any): boolean;
27
- componentWillUnmount?(): void;
28
- componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
29
- getSnapshotBeforeUpdate?(prevProps: Readonly<Props>, prevState: Readonly<{}>): any;
30
- componentDidUpdate?(prevProps: Readonly<Props>, prevState: Readonly<{}>, snapshot?: any): void;
31
- componentWillMount?(): void;
32
- UNSAFE_componentWillMount?(): void;
33
- componentWillReceiveProps?(nextProps: Readonly<Props>, nextContext: any): void;
34
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Props>, nextContext: any): void;
35
- componentWillUpdate?(nextProps: Readonly<Props>, nextState: Readonly<{}>, nextContext: any): void;
36
- UNSAFE_componentWillUpdate?(nextProps: Readonly<Props>, nextState: Readonly<{}>, nextContext: any): void;
37
- };
38
- readonly displayName: string;
39
- contextType?: React.Context<any> | undefined;
40
- };
41
- export {};