@ionic/react 7.5.3-dev.11698858201.14165f23 → 7.5.3-dev.11699994454.1cbf1283
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.
- package/dist/index.js +2443 -8
- package/dist/index.js.map +1 -7
- package/dist/types/components/CreateAnimation.d.ts +71 -0
- package/dist/types/components/IonActionSheet.d.ts +3 -0
- package/dist/types/components/IonAlert.d.ts +3 -0
- package/dist/types/components/IonApp.d.ts +41 -0
- package/dist/types/components/IonIcon.d.ts +16 -0
- package/dist/types/components/IonLoading.d.ts +3 -0
- package/dist/types/components/IonModal.d.ts +3 -0
- package/dist/types/components/IonOverlayManager.d.ts +15 -0
- package/dist/types/components/IonPage.d.ts +3 -0
- package/dist/types/components/IonPicker.d.ts +3 -0
- package/dist/types/components/IonPopover.d.ts +3 -0
- package/dist/types/components/IonRedirect.d.ts +16 -0
- package/dist/types/components/IonRoute.d.ts +17 -0
- package/dist/types/components/IonRouterContext.d.ts +42 -0
- package/dist/types/components/IonRouterOutlet.d.ts +8 -0
- package/dist/types/components/IonToast.d.ts +3 -0
- package/dist/types/components/IonicReactProps.d.ts +6 -0
- package/dist/types/components/__tests__/utils.spec.d.ts +1 -0
- package/dist/types/components/createControllerComponent.d.ts +19 -0
- package/dist/types/components/createInlineOverlayComponent.d.ts +2 -0
- package/dist/types/components/createOverlayComponent.d.ts +20 -0
- package/dist/types/components/createRoutingComponent.d.ts +2 -0
- package/dist/types/components/hrefprops.d.ts +9 -0
- package/dist/types/components/index.d.ts +35 -0
- package/dist/types/components/inner-proxies.d.ts +14 -0
- package/dist/types/components/navigation/IonBackButton.d.ts +68 -0
- package/dist/types/components/navigation/IonNav.d.ts +5 -0
- package/dist/types/components/navigation/IonTabBar.d.ts +15 -0
- package/dist/types/components/navigation/IonTabButton.d.ts +40 -0
- package/dist/types/components/navigation/IonTabs.d.ts +49 -0
- package/dist/types/components/navigation/IonTabsContext.d.ts +6 -0
- package/dist/types/components/proxies.d.ts +66 -0
- package/dist/types/components/react-component-lib/createComponent.d.ts +10 -0
- package/dist/types/components/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/dist/types/components/react-component-lib/index.d.ts +2 -0
- package/dist/types/components/react-component-lib/interfaces.d.ts +29 -0
- package/dist/types/components/react-component-lib/utils/attachProps.d.ts +16 -0
- package/dist/types/components/react-component-lib/utils/case.d.ts +2 -0
- package/dist/types/components/react-component-lib/utils/dev.d.ts +2 -0
- package/dist/types/components/react-component-lib/utils/index.d.ts +10 -0
- package/dist/types/components/routing-proxies.d.ts +44 -0
- package/dist/types/components/utils/detachProps.d.ts +8 -0
- package/dist/types/components/utils/index.d.ts +8 -0
- package/dist/types/components/utils/ionRenderToString.d.ts +2 -0
- package/dist/types/contexts/IonContext.d.ts +7 -0
- package/dist/types/contexts/IonLifeCycleContext.d.ts +72 -0
- package/dist/types/contexts/NavContext.d.ts +17 -0
- package/dist/types/framework-delegate.d.ts +2 -0
- package/dist/types/hooks/HookOverlayOptions.d.ts +7 -0
- package/dist/types/hooks/__tests__/hooks.spec.d.ts +0 -0
- package/dist/types/hooks/useController.d.ts +12 -0
- package/dist/types/hooks/useIonActionSheet.d.ts +26 -0
- package/dist/types/hooks/useIonAlert.d.ts +26 -0
- package/dist/types/hooks/useIonLoading.d.ts +27 -0
- package/dist/types/hooks/useIonModal.d.ts +17 -0
- package/dist/types/hooks/useIonPicker.d.ts +26 -0
- package/dist/types/hooks/useIonPopover.d.ts +17 -0
- package/dist/types/hooks/useIonToast.d.ts +26 -0
- package/dist/types/hooks/useOverlay.d.ts +13 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/lifecycle/IonLifeCycleHOC.d.ts +31 -0
- package/dist/types/lifecycle/hooks.d.ts +5 -0
- package/dist/types/lifecycle/index.d.ts +2 -0
- package/dist/types/models/ReactComponentOrElement.d.ts +2 -0
- package/dist/types/models/RouteAction.d.ts +1 -0
- package/dist/types/models/RouteInfo.d.ts +19 -0
- package/dist/types/models/RouterDirection.d.ts +1 -0
- package/dist/types/models/RouterOptions.d.ts +10 -0
- package/dist/types/models/index.d.ts +5 -0
- package/dist/types/routing/LocationHistory.d.ts +20 -0
- package/dist/types/routing/NavManager.d.ts +38 -0
- package/dist/types/routing/OutletPageManager.d.ts +26 -0
- package/dist/types/routing/PageManager.d.ts +25 -0
- package/dist/types/routing/RouteManagerContext.d.ts +16 -0
- package/dist/types/routing/StackContext.d.ts +7 -0
- package/dist/types/routing/ViewItem.d.ts +12 -0
- package/dist/types/routing/ViewLifeCycleManager.d.ts +42 -0
- package/dist/types/routing/ViewStacks.d.ts +19 -0
- package/dist/types/routing/__tests__/LocationHistory.spec.d.ts +1 -0
- package/dist/types/routing/index.d.ts +7 -0
- package/dist/types/utils/HTMLElementSSR.d.ts +4 -0
- package/dist/types/utils/generateId.d.ts +1 -0
- package/package.json +12 -5
- package/dist/components/CreateAnimation.js +0 -107
- package/dist/components/CreateAnimation.js.map +0 -7
- package/dist/components/IonActionSheet.js +0 -8
- package/dist/components/IonActionSheet.js.map +0 -7
- package/dist/components/IonAlert.js +0 -8
- package/dist/components/IonAlert.js.map +0 -7
- package/dist/components/IonApp.js +0 -42
- package/dist/components/IonApp.js.map +0 -7
- package/dist/components/IonIcon.js +0 -39
- package/dist/components/IonIcon.js.map +0 -7
- package/dist/components/IonLoading.js +0 -8
- package/dist/components/IonLoading.js.map +0 -7
- package/dist/components/IonModal.js +0 -9
- package/dist/components/IonModal.js.map +0 -7
- package/dist/components/IonOverlayManager.js +0 -29
- package/dist/components/IonOverlayManager.js.map +0 -7
- package/dist/components/IonPage.js +0 -31
- package/dist/components/IonPage.js.map +0 -7
- package/dist/components/IonPicker.js +0 -8
- package/dist/components/IonPicker.js.map +0 -7
- package/dist/components/IonPopover.js +0 -8
- package/dist/components/IonPopover.js.map +0 -7
- package/dist/components/IonRedirect.js +0 -19
- package/dist/components/IonRedirect.js.map +0 -7
- package/dist/components/IonRoute.js +0 -17
- package/dist/components/IonRoute.js.map +0 -7
- package/dist/components/IonRouterContext.js +0 -32
- package/dist/components/IonRouterContext.js.map +0 -7
- package/dist/components/IonRouterOutlet.js +0 -24
- package/dist/components/IonRouterOutlet.js.map +0 -7
- package/dist/components/IonToast.js +0 -8
- package/dist/components/IonToast.js.map +0 -7
- package/dist/components/IonicReactProps.js +0 -2
- package/dist/components/IonicReactProps.js.map +0 -7
- package/dist/components/__tests__/utils.spec.js +0 -50
- package/dist/components/__tests__/utils.spec.js.map +0 -7
- package/dist/components/createControllerComponent.js +0 -80
- package/dist/components/createControllerComponent.js.map +0 -7
- package/dist/components/createInlineOverlayComponent.js +0 -114
- package/dist/components/createInlineOverlayComponent.js.map +0 -7
- package/dist/components/createOverlayComponent.js +0 -88
- package/dist/components/createOverlayComponent.js.map +0 -7
- package/dist/components/createRoutingComponent.js +0 -79
- package/dist/components/createRoutingComponent.js.map +0 -7
- package/dist/components/hrefprops.js +0 -2
- package/dist/components/hrefprops.js.map +0 -7
- package/dist/components/index.js +0 -126
- package/dist/components/index.js.map +0 -7
- package/dist/components/inner-proxies.js +0 -30
- package/dist/components/inner-proxies.js.map +0 -7
- package/dist/components/navigation/IonBackButton.js +0 -31
- package/dist/components/navigation/IonBackButton.js.map +0 -7
- package/dist/components/navigation/IonNav.js +0 -21
- package/dist/components/navigation/IonNav.js.map +0 -7
- package/dist/components/navigation/IonTabBar.js +0 -173
- package/dist/components/navigation/IonTabBar.js.map +0 -7
- package/dist/components/navigation/IonTabButton.js +0 -30
- package/dist/components/navigation/IonTabButton.js.map +0 -7
- package/dist/components/navigation/IonTabs.js +0 -103
- package/dist/components/navigation/IonTabs.js.map +0 -7
- package/dist/components/navigation/IonTabsContext.js +0 -7
- package/dist/components/navigation/IonTabsContext.js.map +0 -7
- package/dist/components/proxies.js +0 -131
- package/dist/components/proxies.js.map +0 -7
- package/dist/components/react-component-lib/createComponent.js +0 -58
- package/dist/components/react-component-lib/createComponent.js.map +0 -7
- package/dist/components/react-component-lib/createOverlayComponent.js +0 -86
- package/dist/components/react-component-lib/createOverlayComponent.js.map +0 -7
- package/dist/components/react-component-lib/index.js +0 -4
- package/dist/components/react-component-lib/index.js.map +0 -7
- package/dist/components/react-component-lib/interfaces.js +0 -2
- package/dist/components/react-component-lib/interfaces.js.map +0 -7
- package/dist/components/react-component-lib/utils/attachProps.js +0 -92
- package/dist/components/react-component-lib/utils/attachProps.js.map +0 -7
- package/dist/components/react-component-lib/utils/case.js +0 -4
- package/dist/components/react-component-lib/utils/case.js.map +0 -7
- package/dist/components/react-component-lib/utils/dev.js +0 -14
- package/dist/components/react-component-lib/utils/dev.js.map +0 -7
- package/dist/components/react-component-lib/utils/index.js +0 -31
- package/dist/components/react-component-lib/utils/index.js.map +0 -7
- package/dist/components/routing-proxies.js +0 -29
- package/dist/components/routing-proxies.js.map +0 -7
- package/dist/components/utils/detachProps.js +0 -24
- package/dist/components/utils/detachProps.js.map +0 -7
- package/dist/components/utils/index.js +0 -26
- package/dist/components/utils/index.js.map +0 -7
- package/dist/components/utils/ionRenderToString.js +0 -36
- package/dist/components/utils/ionRenderToString.js.map +0 -7
- package/dist/contexts/IonContext.js +0 -11
- package/dist/contexts/IonContext.js.map +0 -7
- package/dist/contexts/IonLifeCycleContext.js +0 -185
- package/dist/contexts/IonLifeCycleContext.js.map +0 -7
- package/dist/contexts/NavContext.js +0 -36
- package/dist/contexts/NavContext.js.map +0 -7
- package/dist/framework-delegate.js +0 -30
- package/dist/framework-delegate.js.map +0 -7
- package/dist/hooks/HookOverlayOptions.js +0 -2
- package/dist/hooks/HookOverlayOptions.js.map +0 -7
- package/dist/hooks/__tests__/hooks.spec.js +0 -6
- package/dist/hooks/__tests__/hooks.spec.js.map +0 -7
- package/dist/hooks/useController.js +0 -45
- package/dist/hooks/useController.js.map +0 -7
- package/dist/hooks/useIonActionSheet.js +0 -27
- package/dist/hooks/useIonActionSheet.js.map +0 -7
- package/dist/hooks/useIonAlert.js +0 -23
- package/dist/hooks/useIonAlert.js.map +0 -7
- package/dist/hooks/useIonLoading.js +0 -28
- package/dist/hooks/useIonLoading.js.map +0 -7
- package/dist/hooks/useIonModal.js +0 -22
- package/dist/hooks/useIonModal.js.map +0 -7
- package/dist/hooks/useIonPicker.js +0 -27
- package/dist/hooks/useIonPicker.js.map +0 -7
- package/dist/hooks/useIonPopover.js +0 -22
- package/dist/hooks/useIonPopover.js.map +0 -7
- package/dist/hooks/useIonToast.js +0 -23
- package/dist/hooks/useIonToast.js.map +0 -7
- package/dist/hooks/useOverlay.js +0 -67
- package/dist/hooks/useOverlay.js.map +0 -7
- package/dist/lifecycle/IonLifeCycleHOC.js +0 -41
- package/dist/lifecycle/IonLifeCycleHOC.js.map +0 -7
- package/dist/lifecycle/hooks.js +0 -52
- package/dist/lifecycle/hooks.js.map +0 -7
- package/dist/lifecycle/index.js +0 -4
- package/dist/lifecycle/index.js.map +0 -7
- package/dist/models/ReactComponentOrElement.js +0 -2
- package/dist/models/ReactComponentOrElement.js.map +0 -7
- package/dist/models/RouteAction.js +0 -2
- package/dist/models/RouteAction.js.map +0 -7
- package/dist/models/RouteInfo.js +0 -2
- package/dist/models/RouteInfo.js.map +0 -7
- package/dist/models/RouterDirection.js +0 -2
- package/dist/models/RouterDirection.js.map +0 -7
- package/dist/models/RouterOptions.js +0 -2
- package/dist/models/RouterOptions.js.map +0 -7
- package/dist/models/index.js +0 -7
- package/dist/models/index.js.map +0 -7
- package/dist/routing/LocationHistory.js +0 -140
- package/dist/routing/LocationHistory.js.map +0 -7
- package/dist/routing/NavManager.js +0 -76
- package/dist/routing/NavManager.js.map +0 -7
- package/dist/routing/OutletPageManager.js +0 -69
- package/dist/routing/OutletPageManager.js.map +0 -7
- package/dist/routing/PageManager.js +0 -60
- package/dist/routing/PageManager.js.map +0 -7
- package/dist/routing/RouteManagerContext.js +0 -15
- package/dist/routing/RouteManagerContext.js.map +0 -7
- package/dist/routing/StackContext.js +0 -7
- package/dist/routing/StackContext.js.map +0 -7
- package/dist/routing/ViewItem.js +0 -2
- package/dist/routing/ViewItem.js.map +0 -7
- package/dist/routing/ViewLifeCycleManager.js +0 -36
- package/dist/routing/ViewLifeCycleManager.js.map +0 -7
- package/dist/routing/ViewStacks.js +0 -49
- package/dist/routing/ViewStacks.js.map +0 -7
- package/dist/routing/__tests__/LocationHistory.spec.js +0 -185
- package/dist/routing/__tests__/LocationHistory.spec.js.map +0 -7
- package/dist/routing/index.js +0 -9
- package/dist/routing/index.js.map +0 -7
- package/dist/utils/HTMLElementSSR.js +0 -4
- package/dist/utils/HTMLElementSSR.js.map +0 -7
- package/dist/utils/generateId.js +0 -8
- package/dist/utils/generateId.js.map +0 -7
|
@@ -1,69 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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;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BAAoB,iBAAiB;AAAA,EAC5C;AAAA,EAEA,yBAAyB;AACvB,SAAK,oBAAoB,gBAAgB;AAAA,EAC3C;AAAA,EAEA,SAAS;AACP,UAAM,EAAE,cAAc,UAAU,WAAW,GAAG,MAAM,IAAI,KAAK;AAC7D,WACE,oCAAC,oBAAoB,UAApB,MACE,CAAC,YAAY;AACZ,WAAK,sBAAsB;AAC3B,aACE,oCAAC,gBAAa,aACZ;AAAA,QAAC;AAAA;AAAA,UACC,QAAQ,CAAC,QAAqC,KAAK,kBAAkB;AAAA,UACpE,GAAG;AAAA;AAAA,QAEH;AAAA,MACH,CACF;AAAA,IAEJ,CACF;AAAA,EAEJ;AAAA,EAEA,WAAW,cAAc;AACvB,WAAO;AAAA,EACT;AACF;AACA,eAAe;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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,o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B,SAAK,oBAAoB,gBAAgB;AAAA,EAC3C;AAAA,EAEA,0BAA0B;AACxB,SAAK,oBAAoB,iBAAiB;AAAA,EAC5C;AAAA,EAEA,yBAAyB;AACvB,SAAK,oBAAoB,gBAAgB;AAAA,EAC3C;AAAA,EAEA,SAAS;AAEP,UAAM,EAAE,WAAW,UAAU,WAAW,cAAc,GAAG,MAAM,IAAI,KAAK;AAExE,WACE,oCAAC,oBAAoB,UAApB,MACE,CAAC,YAAY;AACZ,WAAK,sBAAsB;AAC3B,aACE,oCAAC,SAAI,WAAW,YAAY,GAAG,SAAS,cAAc,YAAY,KAAK,KAAK,kBAAmB,GAAG,SAC/F,QACH;AAAA,IAEJ,CACF;AAAA,EAEJ;AAAA,EAEA,WAAW,cAAc;AACvB,WAAO;AAAA,EACT;AACF;AACA,eAAe;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/routing/ViewItem.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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,MAA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AA,IAClC;AAAA,IACA,gBAAgB;AAAA,IAChB,eAAe,WAAW;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV;AACA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/routing/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/utils/generateId.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|