@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,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { toastController } from "@ionic/core/components";
|
|
3
|
-
import { defineCustomElement } from "@ionic/core/components/ion-toast.js";
|
|
4
|
-
import { useCallback } from "react";
|
|
5
|
-
import { useController } from "./useController";
|
|
6
|
-
export function useIonToast() {
|
|
7
|
-
const controller = useController("IonToast", toastController, defineCustomElement);
|
|
8
|
-
const present = useCallback(
|
|
9
|
-
(messageOrOptions, duration) => {
|
|
10
|
-
if (typeof messageOrOptions === "string") {
|
|
11
|
-
return controller.present({
|
|
12
|
-
message: messageOrOptions,
|
|
13
|
-
duration
|
|
14
|
-
});
|
|
15
|
-
} else {
|
|
16
|
-
return controller.present(messageOrOptions);
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
[controller.present]
|
|
20
|
-
);
|
|
21
|
-
return [present, controller.dismiss];
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=useIonToast.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/hooks/useIonToast.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ToastOptions } from '@ionic/core/components';\nimport { toastController } from '@ionic/core/components';\nimport { defineCustomElement } from '@ionic/core/components/ion-toast.js';\nimport { useCallback } from 'react';\n\nimport type { HookOverlayOptions } from './HookOverlayOptions';\nimport { useController } from './useController';\n\n/**\n * A hook for presenting/dismissing an IonToast component\n * @returns Returns the present and dismiss methods in an array\n */\nexport function useIonToast(): UseIonToastResult {\n const controller = useController<ToastOptions, HTMLIonToastElement>('IonToast', toastController, defineCustomElement);\n\n const present = useCallback(\n (messageOrOptions: string | (ToastOptions & HookOverlayOptions), duration?: number) => {\n if (typeof messageOrOptions === 'string') {\n return controller.present({\n message: messageOrOptions,\n duration,\n });\n } else {\n return controller.present(messageOrOptions);\n }\n },\n [controller.present]\n );\n\n return [present, controller.dismiss];\n}\n\nexport type UseIonToastResult = [\n {\n /**\n * Presents the toast\n * @param message Message to be shown in the toast.\n * @param duration Optional - How many milliseconds to wait before hiding the toast. By default, it will show until dismissToast() is called.\n */\n (message: string, duration?: number): Promise<void>;\n /**\n * Presents the Toast\n * @param options The options to pass to the IonToast.\n */\n (options: ToastOptions & HookOverlayOptions): Promise<void>;\n },\n /**\n * Dismisses the toast\n */\n () => Promise<void>\n];\n"],
|
|
5
|
-
"mappings": ";AACA,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,mBAAmB;AAG5B,SAAS,qBAAqB;AAMvB,gBAAS,cAAiC;AAC/C,QAAM,aAAa,cAAiD,YAAY,iBAAiB,mBAAmB;AAEpH,QAAM,UAAU;AAAA,IACd,CAAC,kBAAgE,aAAsB;AACrF,UAAI,OAAO,qBAAqB,UAAU;AACxC,eAAO,WAAW,QAAQ;AAAA,UACxB,SAAS;AAAA,UACT;AAAA,QACF,CAAC;AAAA,MACH,OAAO;AACL,eAAO,WAAW,QAAQ,gBAAgB;AAAA,MAC5C;AAAA,IACF;AAAA,IACA,CAAC,WAAW,OAAO;AAAA,EACrB;AAEA,SAAO,CAAC,SAAS,WAAW,OAAO;AACrC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/hooks/useOverlay.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import React, { createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { attachProps } from "../components/react-component-lib/utils";
|
|
4
|
-
import { IonContext } from "../contexts/IonContext";
|
|
5
|
-
import { generateId } from "../utils/generateId";
|
|
6
|
-
export function useOverlay(displayName, controller, defineCustomElement, component, componentProps) {
|
|
7
|
-
const overlayRef = useRef();
|
|
8
|
-
const containerElRef = useRef();
|
|
9
|
-
const didDismissEventName = useMemo(() => `on${displayName}DidDismiss`, [displayName]);
|
|
10
|
-
const didPresentEventName = useMemo(() => `on${displayName}DidPresent`, [displayName]);
|
|
11
|
-
const willDismissEventName = useMemo(() => `on${displayName}WillDismiss`, [displayName]);
|
|
12
|
-
const willPresentEventName = useMemo(() => `on${displayName}WillPresent`, [displayName]);
|
|
13
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
14
|
-
const ionContext = useContext(IonContext);
|
|
15
|
-
const [overlayId] = useState(generateId("overlay"));
|
|
16
|
-
defineCustomElement();
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (isOpen && component && containerElRef.current) {
|
|
19
|
-
if (React.isValidElement(component)) {
|
|
20
|
-
ionContext.addOverlay(overlayId, component, containerElRef.current);
|
|
21
|
-
} else {
|
|
22
|
-
const element = createElement(component, componentProps);
|
|
23
|
-
ionContext.addOverlay(overlayId, element, containerElRef.current);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}, [component, containerElRef.current, isOpen, componentProps]);
|
|
27
|
-
const present = useCallback(async (options) => {
|
|
28
|
-
if (overlayRef.current) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const { onDidDismiss, onWillDismiss, onDidPresent, onWillPresent, ...rest } = options;
|
|
32
|
-
if (typeof document !== "undefined") {
|
|
33
|
-
containerElRef.current = document.createElement("div");
|
|
34
|
-
}
|
|
35
|
-
overlayRef.current = await controller.create({
|
|
36
|
-
...rest,
|
|
37
|
-
component: containerElRef.current
|
|
38
|
-
});
|
|
39
|
-
attachProps(overlayRef.current, {
|
|
40
|
-
[didDismissEventName]: handleDismiss,
|
|
41
|
-
[didPresentEventName]: (e) => onDidPresent && onDidPresent(e),
|
|
42
|
-
[willDismissEventName]: (e) => onWillDismiss && onWillDismiss(e),
|
|
43
|
-
[willPresentEventName]: (e) => onWillPresent && onWillPresent(e)
|
|
44
|
-
});
|
|
45
|
-
overlayRef.current.present();
|
|
46
|
-
setIsOpen(true);
|
|
47
|
-
function handleDismiss(event) {
|
|
48
|
-
if (onDidDismiss) {
|
|
49
|
-
onDidDismiss(event);
|
|
50
|
-
}
|
|
51
|
-
overlayRef.current = void 0;
|
|
52
|
-
containerElRef.current = void 0;
|
|
53
|
-
setIsOpen(false);
|
|
54
|
-
ionContext.removeOverlay(overlayId);
|
|
55
|
-
}
|
|
56
|
-
}, []);
|
|
57
|
-
const dismiss = useCallback(async (data, role) => {
|
|
58
|
-
overlayRef.current && await overlayRef.current.dismiss(data, role);
|
|
59
|
-
overlayRef.current = void 0;
|
|
60
|
-
containerElRef.current = void 0;
|
|
61
|
-
}, []);
|
|
62
|
-
return {
|
|
63
|
-
present,
|
|
64
|
-
dismiss
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=useOverlay.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/hooks/useOverlay.ts"],
|
|
4
|
-
"sourcesContent": ["import type { OverlayEventDetail } from '@ionic/core/components';\nimport React, { createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { attachProps } from '../components/react-component-lib/utils';\nimport { IonContext } from '../contexts/IonContext';\nimport type { ReactComponentOrElement } from '../models/ReactComponentOrElement';\nimport { generateId } from '../utils/generateId';\n\nimport type { HookOverlayOptions } from './HookOverlayOptions';\n\n// TODO(FW-2959): types\n\ninterface OverlayBase extends HTMLElement {\n present: () => Promise<void>;\n dismiss: (data?: any, role?: string | undefined) => Promise<boolean>;\n}\n\nexport function useOverlay<OptionsType, OverlayType extends OverlayBase>(\n displayName: string,\n controller: { create: (options: OptionsType) => Promise<OverlayType> },\n defineCustomElement: () => void,\n component: ReactComponentOrElement,\n componentProps?: any\n) {\n const overlayRef = useRef<OverlayType>();\n const containerElRef = useRef<HTMLDivElement>();\n const didDismissEventName = useMemo(() => `on${displayName}DidDismiss`, [displayName]);\n const didPresentEventName = useMemo(() => `on${displayName}DidPresent`, [displayName]);\n const willDismissEventName = useMemo(() => `on${displayName}WillDismiss`, [displayName]);\n const willPresentEventName = useMemo(() => `on${displayName}WillPresent`, [displayName]);\n const [isOpen, setIsOpen] = useState(false);\n const ionContext = useContext(IonContext);\n const [overlayId] = useState(generateId('overlay'));\n\n defineCustomElement();\n\n useEffect(() => {\n if (isOpen && component && containerElRef.current) {\n if (React.isValidElement(component)) {\n ionContext.addOverlay(overlayId, component, containerElRef.current!);\n } else {\n const element = createElement(component as React.ComponentClass, componentProps);\n ionContext.addOverlay(overlayId, element, containerElRef.current!);\n }\n }\n }, [component, containerElRef.current, isOpen, componentProps]);\n\n const present = useCallback(async (options: OptionsType & HookOverlayOptions) => {\n if (overlayRef.current) {\n return;\n }\n\n const { onDidDismiss, onWillDismiss, onDidPresent, onWillPresent, ...rest } = options;\n\n if (typeof document !== 'undefined') {\n containerElRef.current = document.createElement('div');\n }\n\n overlayRef.current = await controller.create({\n ...(rest as any),\n component: containerElRef.current,\n });\n\n attachProps(overlayRef.current, {\n [didDismissEventName]: handleDismiss,\n [didPresentEventName]: (e: CustomEvent) => onDidPresent && onDidPresent(e),\n [willDismissEventName]: (e: CustomEvent) => onWillDismiss && onWillDismiss(e),\n [willPresentEventName]: (e: CustomEvent) => onWillPresent && onWillPresent(e),\n });\n\n overlayRef.current.present();\n\n setIsOpen(true);\n\n function handleDismiss(event: CustomEvent<OverlayEventDetail<any>>) {\n if (onDidDismiss) {\n onDidDismiss(event);\n }\n overlayRef.current = undefined;\n containerElRef.current = undefined;\n setIsOpen(false);\n ionContext.removeOverlay(overlayId);\n }\n }, []);\n\n const dismiss = useCallback(async (data?: any, role?: string) => {\n overlayRef.current && (await overlayRef.current.dismiss(data, role));\n overlayRef.current = undefined;\n containerElRef.current = undefined;\n }, []);\n\n return {\n present,\n dismiss,\n };\n}\n"],
|
|
5
|
-
"mappings": ";AACA,OAAO,SAAS,eAAe,aAAa,YAAY,WAAW,SAAS,QAAQ,gBAAgB;AAEpG,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAE3B,SAAS,kBAAkB;AAWpB,gBAAS,WACd,aACA,YACA,qBACA,WACA,gBACA;AACA,QAAM,aAAa,OAAoB;AACvC,QAAM,iBAAiB,OAAuB;AAC9C,QAAM,sBAAsB,QAAQ,MAAM,KAAK,WAAW,cAAc,CAAC,WAAW,CAAC;AACrF,QAAM,sBAAsB,QAAQ,MAAM,KAAK,WAAW,cAAc,CAAC,WAAW,CAAC;AACrF,QAAM,uBAAuB,QAAQ,MAAM,KAAK,WAAW,eAAe,CAAC,WAAW,CAAC;AACvF,QAAM,uBAAuB,QAAQ,MAAM,KAAK,WAAW,eAAe,CAAC,WAAW,CAAC;AACvF,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,QAAM,aAAa,WAAW,UAAU;AACxC,QAAM,CAAC,SAAS,IAAI,SAAS,WAAW,SAAS,CAAC;AAElD,sBAAoB;AAEpB,YAAU,MAAM;AACd,QAAI,UAAU,aAAa,eAAe,SAAS;AACjD,UAAI,MAAM,eAAe,SAAS,GAAG;AACnC,mBAAW,WAAW,WAAW,WAAW,eAAe,OAAQ;AAAA,MACrE,OAAO;AACL,cAAM,UAAU,cAAc,WAAmC,cAAc;AAC/E,mBAAW,WAAW,WAAW,SAAS,eAAe,OAAQ;AAAA,MACnE;AAAA,IACF;AAAA,EACF,GAAG,CAAC,WAAW,eAAe,SAAS,QAAQ,cAAc,CAAC;AAE9D,QAAM,UAAU,YAAY,OAAO,YAA8C;AAC/E,QAAI,WAAW,SAAS;AACtB;AAAA,IACF;AAEA,UAAM,EAAE,cAAc,eAAe,cAAc,eAAe,GAAG,KAAK,IAAI;AAE9E,QAAI,OAAO,aAAa,aAAa;AACnC,qBAAe,UAAU,SAAS,cAAc,KAAK;AAAA,IACvD;AAEA,eAAW,UAAU,MAAM,WAAW,OAAO;AAAA,MAC3C,GAAI;AAAA,MACJ,WAAW,eAAe;AAAA,IAC5B,CAAC;AAED,gBAAY,WAAW,SAAS;AAAA,MAC9B,CAAC,mBAAmB,GAAG;AAAA,MACvB,CAAC,mBAAmB,GAAG,CAAC,MAAmB,gBAAgB,aAAa,CAAC;AAAA,MACzE,CAAC,oBAAoB,GAAG,CAAC,MAAmB,iBAAiB,cAAc,CAAC;AAAA,MAC5E,CAAC,oBAAoB,GAAG,CAAC,MAAmB,iBAAiB,cAAc,CAAC;AAAA,IAC9E,CAAC;AAED,eAAW,QAAQ,QAAQ;AAE3B,cAAU,IAAI;AAEd,aAAS,cAAc,OAA6C;AAClE,UAAI,cAAc;AAChB,qBAAa,KAAK;AAAA,MACpB;AACA,iBAAW,UAAU;AACrB,qBAAe,UAAU;AACzB,gBAAU,KAAK;AACf,iBAAW,cAAc,SAAS;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,UAAU,YAAY,OAAO,MAAY,SAAkB;AAC/D,eAAW,WAAY,MAAM,WAAW,QAAQ,QAAQ,MAAM,IAAI;AAClE,eAAW,UAAU;AACrB,mBAAe,UAAU;AAAA,EAC3B,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { IonLifeCycleContext } from "../contexts/IonLifeCycleContext";
|
|
4
|
-
export const withIonLifeCycle = (WrappedComponent) => {
|
|
5
|
-
return class IonLifeCycle extends React.Component {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super(props);
|
|
8
|
-
this.componentRef = React.createRef();
|
|
9
|
-
}
|
|
10
|
-
componentDidMount() {
|
|
11
|
-
const element = this.componentRef.current;
|
|
12
|
-
this.context.onIonViewWillEnter(() => {
|
|
13
|
-
if (element && element.ionViewWillEnter) {
|
|
14
|
-
element.ionViewWillEnter();
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
this.context.onIonViewDidEnter(() => {
|
|
18
|
-
if (element && element.ionViewDidEnter) {
|
|
19
|
-
element.ionViewDidEnter();
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
this.context.onIonViewWillLeave(() => {
|
|
23
|
-
if (element && element.ionViewWillLeave) {
|
|
24
|
-
element.ionViewWillLeave();
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
this.context.onIonViewDidLeave(() => {
|
|
28
|
-
if (element && element.ionViewDidLeave) {
|
|
29
|
-
element.ionViewDidLeave();
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
render() {
|
|
34
|
-
return /* @__PURE__ */ React.createElement(IonLifeCycleContext.Consumer, null, (context) => {
|
|
35
|
-
this.context = context;
|
|
36
|
-
return /* @__PURE__ */ React.createElement(WrappedComponent, { ref: this.componentRef, ...this.props });
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=IonLifeCycleHOC.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/lifecycle/IonLifeCycleHOC.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\n\nimport { IonLifeCycleContext } from '../contexts/IonLifeCycleContext';\n\n// TODO(FW-2959): types\n\nexport const withIonLifeCycle = (WrappedComponent: React.ComponentType<any>) => {\n return class IonLifeCycle extends React.Component<any, any> {\n context!: React.ContextType<typeof IonLifeCycleContext>;\n componentRef = React.createRef<any>();\n\n constructor(props: any) {\n super(props);\n }\n\n componentDidMount() {\n const element = this.componentRef.current;\n this.context.onIonViewWillEnter(() => {\n if (element && element.ionViewWillEnter) {\n element.ionViewWillEnter();\n }\n });\n\n this.context.onIonViewDidEnter(() => {\n if (element && element.ionViewDidEnter) {\n element.ionViewDidEnter();\n }\n });\n\n this.context.onIonViewWillLeave(() => {\n if (element && element.ionViewWillLeave) {\n element.ionViewWillLeave();\n }\n });\n\n this.context.onIonViewDidLeave(() => {\n if (element && element.ionViewDidLeave) {\n element.ionViewDidLeave();\n }\n });\n }\n\n render() {\n return (\n <IonLifeCycleContext.Consumer>\n {(context) => {\n this.context = context;\n return <WrappedComponent ref={this.componentRef} {...this.props} />;\n }}\n </IonLifeCycleContext.Consumer>\n );\n }\n };\n};\n"],
|
|
5
|
-
"mappings": ";AAAA,OAAO,WAAW;AAElB,SAAS,2BAA2B;AAI7B,aAAM,mBAAmB,CAAC,qBAA+C;AAC9E,SAAO,MAAM,qBAAqB,MAAM,UAAoB;AAAA,IAI1D,YAAY,OAAY;AACtB,YAAM,KAAK;AAHb,0BAAe,MAAM,UAAe;AAAA,IAIpC;AAAA,IAEA,oBAAoB;AAClB,YAAM,UAAU,KAAK,aAAa;AAClC,WAAK,QAAQ,mBAAmB,MAAM;AACpC,YAAI,WAAW,QAAQ,kBAAkB;AACvC,kBAAQ,iBAAiB;AAAA,QAC3B;AAAA,MACF,CAAC;AAED,WAAK,QAAQ,kBAAkB,MAAM;AACnC,YAAI,WAAW,QAAQ,iBAAiB;AACtC,kBAAQ,gBAAgB;AAAA,QAC1B;AAAA,MACF,CAAC;AAED,WAAK,QAAQ,mBAAmB,MAAM;AACpC,YAAI,WAAW,QAAQ,kBAAkB;AACvC,kBAAQ,iBAAiB;AAAA,QAC3B;AAAA,MACF,CAAC;AAED,WAAK,QAAQ,kBAAkB,MAAM;AACnC,YAAI,WAAW,QAAQ,iBAAiB;AACtC,kBAAQ,gBAAgB;AAAA,QAC1B;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IAEA,SAAS;AACP,aACE,oCAAC,oBAAoB,UAApB,MACE,CAAC,YAAY;AACZ,aAAK,UAAU;AACf,eAAO,oCAAC,oBAAiB,KAAK,KAAK,cAAe,GAAG,KAAK,OAAO;AAAA,MACnE,CACF;AAAA,IAEJ;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/lifecycle/hooks.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { useContext, useEffect, useRef } from "react";
|
|
3
|
-
import { IonLifeCycleContext } from "../contexts/IonLifeCycleContext";
|
|
4
|
-
export const useIonViewWillEnter = (callback, deps = []) => {
|
|
5
|
-
const context = useContext(IonLifeCycleContext);
|
|
6
|
-
const id = useRef();
|
|
7
|
-
id.current = id.current || Math.floor(Math.random() * 1e6);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
callback.id = id.current;
|
|
10
|
-
context.onIonViewWillEnter(callback);
|
|
11
|
-
return () => {
|
|
12
|
-
context.cleanupIonViewWillEnter(callback);
|
|
13
|
-
};
|
|
14
|
-
}, deps);
|
|
15
|
-
};
|
|
16
|
-
export const useIonViewDidEnter = (callback, deps = []) => {
|
|
17
|
-
const context = useContext(IonLifeCycleContext);
|
|
18
|
-
const id = useRef();
|
|
19
|
-
id.current = id.current || Math.floor(Math.random() * 1e6);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
callback.id = id.current;
|
|
22
|
-
context.onIonViewDidEnter(callback);
|
|
23
|
-
return () => {
|
|
24
|
-
context.cleanupIonViewDidEnter(callback);
|
|
25
|
-
};
|
|
26
|
-
}, deps);
|
|
27
|
-
};
|
|
28
|
-
export const useIonViewWillLeave = (callback, deps = []) => {
|
|
29
|
-
const context = useContext(IonLifeCycleContext);
|
|
30
|
-
const id = useRef();
|
|
31
|
-
id.current = id.current || Math.floor(Math.random() * 1e6);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
callback.id = id.current;
|
|
34
|
-
context.onIonViewWillLeave(callback);
|
|
35
|
-
return () => {
|
|
36
|
-
context.cleanupIonViewWillLeave(callback);
|
|
37
|
-
};
|
|
38
|
-
}, deps);
|
|
39
|
-
};
|
|
40
|
-
export const useIonViewDidLeave = (callback, deps = []) => {
|
|
41
|
-
const context = useContext(IonLifeCycleContext);
|
|
42
|
-
const id = useRef();
|
|
43
|
-
id.current = id.current || Math.floor(Math.random() * 1e6);
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
callback.id = id.current;
|
|
46
|
-
context.onIonViewDidLeave(callback);
|
|
47
|
-
return () => {
|
|
48
|
-
context.cleanupIonViewDidLeave(callback);
|
|
49
|
-
};
|
|
50
|
-
}, deps);
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=hooks.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/lifecycle/hooks.ts"],
|
|
4
|
-
"sourcesContent": ["import { useContext, useEffect, useRef } from 'react';\n\nimport type { LifeCycleCallback } from '../contexts/IonLifeCycleContext';\nimport { IonLifeCycleContext } from '../contexts/IonLifeCycleContext';\n\nexport const useIonViewWillEnter = (callback: LifeCycleCallback, deps: any[] = []) => {\n const context = useContext(IonLifeCycleContext);\n const id = useRef<number | undefined>();\n id.current = id.current || Math.floor(Math.random() * 1000000);\n useEffect(() => {\n callback.id = id.current!;\n context.onIonViewWillEnter(callback);\n return () => {\n context.cleanupIonViewWillEnter(callback);\n };\n }, deps);\n};\n\nexport const useIonViewDidEnter = (callback: LifeCycleCallback, deps: any[] = []) => {\n const context = useContext(IonLifeCycleContext);\n const id = useRef<number | undefined>();\n id.current = id.current || Math.floor(Math.random() * 1000000);\n useEffect(() => {\n callback.id = id.current!;\n context.onIonViewDidEnter(callback);\n return () => {\n context.cleanupIonViewDidEnter(callback);\n };\n }, deps);\n};\n\nexport const useIonViewWillLeave = (callback: LifeCycleCallback, deps: any[] = []) => {\n const context = useContext(IonLifeCycleContext);\n const id = useRef<number | undefined>();\n id.current = id.current || Math.floor(Math.random() * 1000000);\n useEffect(() => {\n callback.id = id.current!;\n context.onIonViewWillLeave(callback);\n return () => {\n context.cleanupIonViewWillLeave(callback);\n };\n }, deps);\n};\n\nexport const useIonViewDidLeave = (callback: LifeCycleCallback, deps: any[] = []) => {\n const context = useContext(IonLifeCycleContext);\n const id = useRef<number | undefined>();\n id.current = id.current || Math.floor(Math.random() * 1000000);\n useEffect(() => {\n callback.id = id.current!;\n context.onIonViewDidLeave(callback);\n return () => {\n context.cleanupIonViewDidLeave(callback);\n };\n }, deps);\n};\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,YAAY,WAAW,cAAc;AAG9C,SAAS,2BAA2B;AAE7B,aAAM,sBAAsB,CAAC,UAA6B,OAAc,CAAC,MAAM;AACpF,QAAM,UAAU,WAAW,mBAAmB;AAC9C,QAAM,KAAK,OAA2B;AACtC,KAAG,UAAU,GAAG,WAAW,KAAK,MAAM,KAAK,OAAO,IAAI,GAAO;AAC7D,YAAU,MAAM;AACd,aAAS,KAAK,GAAG;AACjB,YAAQ,mBAAmB,QAAQ;AACnC,WAAO,MAAM;AACX,cAAQ,wBAAwB,QAAQ;AAAA,IAC1C;AAAA,EACF,GAAG,IAAI;AACT;AAEO,aAAM,qBAAqB,CAAC,UAA6B,OAAc,CAAC,MAAM;AACnF,QAAM,UAAU,WAAW,mBAAmB;AAC9C,QAAM,KAAK,OAA2B;AACtC,KAAG,UAAU,GAAG,WAAW,KAAK,MAAM,KAAK,OAAO,IAAI,GAAO;AAC7D,YAAU,MAAM;AACd,aAAS,KAAK,GAAG;AACjB,YAAQ,kBAAkB,QAAQ;AAClC,WAAO,MAAM;AACX,cAAQ,uBAAuB,QAAQ;AAAA,IACzC;AAAA,EACF,GAAG,IAAI;AACT;AAEO,aAAM,sBAAsB,CAAC,UAA6B,OAAc,CAAC,MAAM;AACpF,QAAM,UAAU,WAAW,mBAAmB;AAC9C,QAAM,KAAK,OAA2B;AACtC,KAAG,UAAU,GAAG,WAAW,KAAK,MAAM,KAAK,OAAO,IAAI,GAAO;AAC7D,YAAU,MAAM;AACd,aAAS,KAAK,GAAG;AACjB,YAAQ,mBAAmB,QAAQ;AACnC,WAAO,MAAM;AACX,cAAQ,wBAAwB,QAAQ;AAAA,IAC1C;AAAA,EACF,GAAG,IAAI;AACT;AAEO,aAAM,qBAAqB,CAAC,UAA6B,OAAc,CAAC,MAAM;AACnF,QAAM,UAAU,WAAW,mBAAmB;AAC9C,QAAM,KAAK,OAA2B;AACtC,KAAG,UAAU,GAAG,WAAW,KAAK,MAAM,KAAK,OAAO,IAAI,GAAO;AAC7D,YAAU,MAAM;AACd,aAAS,KAAK,GAAG;AACjB,YAAQ,kBAAkB,QAAQ;AAClC,WAAO,MAAM;AACX,cAAQ,uBAAuB,QAAQ;AAAA,IACzC;AAAA,EACF,GAAG,IAAI;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/lifecycle/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/lifecycle/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { withIonLifeCycle } from './IonLifeCycleHOC';\nexport { useIonViewDidEnter, useIonViewDidLeave, useIonViewWillEnter, useIonViewWillLeave } from './hooks';\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,wBAAwB;AACjC,SAAS,oBAAoB,oBAAoB,qBAAqB,2BAA2B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/models/RouteInfo.js
DELETED
package/dist/models/index.js
DELETED
package/dist/models/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/models/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './RouteAction';\nexport * from './RouteInfo';\nexport * from './RouterDirection';\nexport * from './RouterOptions';\nexport * from './ReactComponentOrElement';\n"],
|
|
5
|
-
"mappings": ";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
export class LocationHistory {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.locationHistory = [];
|
|
5
|
-
this.tabHistory = {};
|
|
6
|
-
}
|
|
7
|
-
add(routeInfo) {
|
|
8
|
-
if (routeInfo.routeAction === "push" || routeInfo.routeAction == null) {
|
|
9
|
-
this._add(routeInfo);
|
|
10
|
-
} else if (routeInfo.routeAction === "pop") {
|
|
11
|
-
this._pop(routeInfo);
|
|
12
|
-
} else if (routeInfo.routeAction === "replace") {
|
|
13
|
-
this._replace(routeInfo);
|
|
14
|
-
}
|
|
15
|
-
if (routeInfo.routeDirection === "root") {
|
|
16
|
-
this._clear();
|
|
17
|
-
this._add(routeInfo);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
clearTabStack(tab) {
|
|
21
|
-
const routeInfos = this._getRouteInfosByKey(tab);
|
|
22
|
-
if (routeInfos) {
|
|
23
|
-
routeInfos.forEach((ri) => {
|
|
24
|
-
this.locationHistory = this.locationHistory.filter((x) => x.id !== ri.id);
|
|
25
|
-
});
|
|
26
|
-
this.tabHistory[tab] = [];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
update(routeInfo) {
|
|
30
|
-
const locationIndex = this.locationHistory.findIndex((x) => x.id === routeInfo.id);
|
|
31
|
-
if (locationIndex > -1) {
|
|
32
|
-
this.locationHistory.splice(locationIndex, 1, routeInfo);
|
|
33
|
-
}
|
|
34
|
-
const tabArray = this.tabHistory[routeInfo.tab || ""];
|
|
35
|
-
if (tabArray) {
|
|
36
|
-
const tabIndex = tabArray.findIndex((x) => x.id === routeInfo.id);
|
|
37
|
-
if (tabIndex > -1) {
|
|
38
|
-
tabArray.splice(tabIndex, 1, routeInfo);
|
|
39
|
-
} else {
|
|
40
|
-
tabArray.push(routeInfo);
|
|
41
|
-
}
|
|
42
|
-
} else if (routeInfo.tab) {
|
|
43
|
-
this.tabHistory[routeInfo.tab] = [routeInfo];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
_add(routeInfo) {
|
|
47
|
-
const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
|
|
48
|
-
if (routeInfos) {
|
|
49
|
-
if (this._areRoutesEqual(routeInfos[routeInfos.length - 1], routeInfo)) {
|
|
50
|
-
routeInfos.pop();
|
|
51
|
-
}
|
|
52
|
-
routeInfos.push(routeInfo);
|
|
53
|
-
}
|
|
54
|
-
this.locationHistory.push(routeInfo);
|
|
55
|
-
}
|
|
56
|
-
_areRoutesEqual(route1, route2) {
|
|
57
|
-
if (!route1 || !route2) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
return route1.pathname === route2.pathname && route1.search === route2.search;
|
|
61
|
-
}
|
|
62
|
-
_pop(routeInfo) {
|
|
63
|
-
const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
|
|
64
|
-
if (routeInfos) {
|
|
65
|
-
routeInfos.pop();
|
|
66
|
-
routeInfos.pop();
|
|
67
|
-
routeInfos.push(routeInfo);
|
|
68
|
-
}
|
|
69
|
-
this.locationHistory.pop();
|
|
70
|
-
this.locationHistory.pop();
|
|
71
|
-
this.locationHistory.push(routeInfo);
|
|
72
|
-
}
|
|
73
|
-
_replace(routeInfo) {
|
|
74
|
-
const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
|
|
75
|
-
routeInfos && routeInfos.pop();
|
|
76
|
-
this.locationHistory.pop();
|
|
77
|
-
this._add(routeInfo);
|
|
78
|
-
}
|
|
79
|
-
_clear() {
|
|
80
|
-
const keys = Object.keys(this.tabHistory);
|
|
81
|
-
keys.forEach((k) => this.tabHistory[k] = []);
|
|
82
|
-
this.locationHistory = [];
|
|
83
|
-
}
|
|
84
|
-
_getRouteInfosByKey(key) {
|
|
85
|
-
let routeInfos;
|
|
86
|
-
if (key) {
|
|
87
|
-
routeInfos = this.tabHistory[key];
|
|
88
|
-
if (!routeInfos) {
|
|
89
|
-
routeInfos = this.tabHistory[key] = [];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return routeInfos;
|
|
93
|
-
}
|
|
94
|
-
getFirstRouteInfoForTab(tab) {
|
|
95
|
-
const routeInfos = this._getRouteInfosByKey(tab);
|
|
96
|
-
if (routeInfos) {
|
|
97
|
-
return routeInfos[0];
|
|
98
|
-
}
|
|
99
|
-
return void 0;
|
|
100
|
-
}
|
|
101
|
-
getCurrentRouteInfoForTab(tab) {
|
|
102
|
-
const routeInfos = this._getRouteInfosByKey(tab);
|
|
103
|
-
if (routeInfos) {
|
|
104
|
-
return routeInfos[routeInfos.length - 1];
|
|
105
|
-
}
|
|
106
|
-
return void 0;
|
|
107
|
-
}
|
|
108
|
-
findLastLocation(routeInfo) {
|
|
109
|
-
const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
|
|
110
|
-
if (routeInfos) {
|
|
111
|
-
for (let i = routeInfos.length - 2; i >= 0; i--) {
|
|
112
|
-
const ri = routeInfos[i];
|
|
113
|
-
if (ri) {
|
|
114
|
-
if (ri.pathname === routeInfo.pushedByRoute) {
|
|
115
|
-
return ri;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
for (let i = this.locationHistory.length - 2; i >= 0; i--) {
|
|
121
|
-
const ri = this.locationHistory[i];
|
|
122
|
-
if (ri) {
|
|
123
|
-
if (ri.pathname === routeInfo.pushedByRoute) {
|
|
124
|
-
return ri;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return void 0;
|
|
129
|
-
}
|
|
130
|
-
previous() {
|
|
131
|
-
return this.locationHistory[this.locationHistory.length - 2] || this.locationHistory[this.locationHistory.length - 1];
|
|
132
|
-
}
|
|
133
|
-
current() {
|
|
134
|
-
return this.locationHistory[this.locationHistory.length - 1];
|
|
135
|
-
}
|
|
136
|
-
canGoBack() {
|
|
137
|
-
return this.locationHistory.length > 1;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
//# sourceMappingURL=LocationHistory.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/routing/LocationHistory.ts"],
|
|
4
|
-
"sourcesContent": ["import type { RouteInfo } from '../models/RouteInfo';\n\n// const RESTRICT_SIZE = 100;\n\nexport class LocationHistory {\n private locationHistory: RouteInfo[] = [];\n private tabHistory: {\n [key: string]: RouteInfo[];\n } = {};\n\n add(routeInfo: RouteInfo) {\n if (routeInfo.routeAction === 'push' || routeInfo.routeAction == null) {\n this._add(routeInfo);\n } else if (routeInfo.routeAction === 'pop') {\n this._pop(routeInfo);\n } else if (routeInfo.routeAction === 'replace') {\n this._replace(routeInfo);\n }\n\n if (routeInfo.routeDirection === 'root') {\n this._clear();\n this._add(routeInfo);\n }\n }\n\n clearTabStack(tab: string) {\n const routeInfos = this._getRouteInfosByKey(tab);\n if (routeInfos) {\n routeInfos.forEach((ri) => {\n this.locationHistory = this.locationHistory.filter((x) => x.id !== ri.id);\n });\n this.tabHistory[tab] = [];\n }\n }\n\n update(routeInfo: RouteInfo) {\n const locationIndex = this.locationHistory.findIndex((x) => x.id === routeInfo.id);\n if (locationIndex > -1) {\n this.locationHistory.splice(locationIndex, 1, routeInfo);\n }\n const tabArray = this.tabHistory[routeInfo.tab || ''];\n if (tabArray) {\n const tabIndex = tabArray.findIndex((x) => x.id === routeInfo.id);\n if (tabIndex > -1) {\n tabArray.splice(tabIndex, 1, routeInfo);\n } else {\n tabArray.push(routeInfo);\n }\n } else if (routeInfo.tab) {\n this.tabHistory[routeInfo.tab] = [routeInfo];\n }\n }\n\n private _add(routeInfo: RouteInfo) {\n const routeInfos = this._getRouteInfosByKey(routeInfo.tab);\n if (routeInfos) {\n // If the latest routeInfo is the same (going back and forth between tabs), replace it\n if (this._areRoutesEqual(routeInfos[routeInfos.length - 1], routeInfo)) {\n routeInfos.pop();\n }\n routeInfos.push(routeInfo);\n }\n this.locationHistory.push(routeInfo);\n }\n\n private _areRoutesEqual(route1?: RouteInfo, route2?: RouteInfo) {\n if (!route1 || !route2) {\n return false;\n }\n return route1.pathname === route2.pathname && route1.search === route2.search;\n }\n\n private _pop(routeInfo: RouteInfo) {\n const routeInfos = this._getRouteInfosByKey(routeInfo.tab);\n\n if (routeInfos) {\n // Pop the previous route\n routeInfos.pop();\n // Replace the current route with an updated version\n routeInfos.pop();\n routeInfos.push(routeInfo);\n }\n\n // Pop the previous route\n this.locationHistory.pop();\n // Replace the current route with an updated version\n this.locationHistory.pop();\n this.locationHistory.push(routeInfo);\n }\n\n private _replace(routeInfo: RouteInfo) {\n const routeInfos = this._getRouteInfosByKey(routeInfo.tab);\n routeInfos && routeInfos.pop();\n this.locationHistory.pop();\n this._add(routeInfo);\n }\n\n private _clear() {\n const keys = Object.keys(this.tabHistory);\n keys.forEach((k) => (this.tabHistory[k] = []));\n this.locationHistory = [];\n }\n\n private _getRouteInfosByKey(key?: string) {\n let routeInfos: RouteInfo[] | undefined;\n if (key) {\n routeInfos = this.tabHistory[key];\n if (!routeInfos) {\n routeInfos = this.tabHistory[key] = [];\n }\n }\n return routeInfos;\n }\n\n getFirstRouteInfoForTab(tab: string) {\n const routeInfos = this._getRouteInfosByKey(tab);\n if (routeInfos) {\n return routeInfos[0];\n }\n return undefined;\n }\n\n getCurrentRouteInfoForTab(tab?: string) {\n const routeInfos = this._getRouteInfosByKey(tab);\n if (routeInfos) {\n return routeInfos[routeInfos.length - 1];\n }\n return undefined;\n }\n\n findLastLocation(routeInfo: RouteInfo) {\n const routeInfos = this._getRouteInfosByKey(routeInfo.tab);\n if (routeInfos) {\n for (let i = routeInfos.length - 2; i >= 0; i--) {\n const ri = routeInfos[i];\n if (ri) {\n if (ri.pathname === routeInfo.pushedByRoute) {\n return ri;\n }\n }\n }\n }\n for (let i = this.locationHistory.length - 2; i >= 0; i--) {\n const ri = this.locationHistory[i];\n if (ri) {\n if (ri.pathname === routeInfo.pushedByRoute) {\n return ri;\n }\n }\n }\n return undefined;\n }\n\n previous() {\n return (\n this.locationHistory[this.locationHistory.length - 2] || this.locationHistory[this.locationHistory.length - 1]\n );\n }\n\n current() {\n return this.locationHistory[this.locationHistory.length - 1];\n }\n\n canGoBack() {\n return this.locationHistory.length > 1;\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAIO,aAAM,gBAAgB;AAAA,EAAtB;AACL,SAAQ,kBAA+B,CAAC;AACxC,SAAQ,aAEJ,CAAC;AAAA;AAAA,EAEL,IAAI,WAAsB;AACxB,QAAI,UAAU,gBAAgB,UAAU,UAAU,eAAe,MAAM;AACrE,WAAK,KAAK,SAAS;AAAA,IACrB,WAAW,UAAU,gBAAgB,OAAO;AAC1C,WAAK,KAAK,SAAS;AAAA,IACrB,WAAW,UAAU,gBAAgB,WAAW;AAC9C,WAAK,SAAS,SAAS;AAAA,IACzB;AAEA,QAAI,UAAU,mBAAmB,QAAQ;AACvC,WAAK,OAAO;AACZ,WAAK,KAAK,SAAS;AAAA,IACrB;AAAA,EACF;AAAA,EAEA,cAAc,KAAa;AACzB,UAAM,aAAa,KAAK,oBAAoB,GAAG;AAC/C,QAAI,YAAY;AACd,iBAAW,QAAQ,CAAC,OAAO;AACzB,aAAK,kBAAkB,KAAK,gBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,EAAE;AAAA,MAC1E,CAAC;AACD,WAAK,WAAW,GAAG,IAAI,CAAC;AAAA,IAC1B;AAAA,EACF;AAAA,EAEA,OAAO,WAAsB;AAC3B,UAAM,gBAAgB,KAAK,gBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,UAAU,EAAE;AACjF,QAAI,gBAAgB,IAAI;AACtB,WAAK,gBAAgB,OAAO,eAAe,GAAG,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KAAK,gBAAgB,KAAK,gBAAgB,SAAS,CAAC;AAAA,EAEjH;AAAA,EAEA,UAAU;AACR,WAAO,KAAK,gBAAgB,KAAK,gBAAgB,SAAS,CAAC;AAAA,EAC7D;AAAA,EAEA,YAAY;AACV,WAAO,KAAK,gBAAgB,SAAS;AAAA,EACvC;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { IonRouterContext } from "../components/IonRouterContext";
|
|
4
|
-
import { NavContext } from "../contexts/NavContext";
|
|
5
|
-
import PageManager from "./PageManager";
|
|
6
|
-
export class NavManager extends React.PureComponent {
|
|
7
|
-
constructor(props) {
|
|
8
|
-
super(props);
|
|
9
|
-
this.ionRouterContextValue = {
|
|
10
|
-
push: (pathname, routerDirection, routeAction, routerOptions, animationBuilder) => {
|
|
11
|
-
this.navigate(pathname, routerDirection, routeAction, animationBuilder, routerOptions);
|
|
12
|
-
},
|
|
13
|
-
back: (animationBuilder) => {
|
|
14
|
-
this.goBack(void 0, animationBuilder);
|
|
15
|
-
},
|
|
16
|
-
canGoBack: () => this.props.locationHistory.canGoBack(),
|
|
17
|
-
nativeBack: () => this.props.onNativeBack(),
|
|
18
|
-
routeInfo: this.props.routeInfo
|
|
19
|
-
};
|
|
20
|
-
this.state = {
|
|
21
|
-
goBack: this.goBack.bind(this),
|
|
22
|
-
hasIonicRouter: () => true,
|
|
23
|
-
navigate: this.navigate.bind(this),
|
|
24
|
-
getIonRedirect: this.getIonRedirect.bind(this),
|
|
25
|
-
getIonRoute: this.getIonRoute.bind(this),
|
|
26
|
-
getStackManager: this.getStackManager.bind(this),
|
|
27
|
-
getPageManager: this.getPageManager.bind(this),
|
|
28
|
-
routeInfo: this.props.routeInfo,
|
|
29
|
-
setCurrentTab: this.props.onSetCurrentTab,
|
|
30
|
-
changeTab: this.props.onChangeTab,
|
|
31
|
-
resetTab: this.props.onResetTab
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
componentDidMount() {
|
|
35
|
-
if (typeof document !== "undefined") {
|
|
36
|
-
this.handleHardwareBackButton = this.handleHardwareBackButton.bind(this);
|
|
37
|
-
document.addEventListener("ionBackButton", this.handleHardwareBackButton);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
componentWillUnmount() {
|
|
41
|
-
if (typeof document !== "undefined") {
|
|
42
|
-
document.removeEventListener("ionBackButton", this.handleHardwareBackButton);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
handleHardwareBackButton(e) {
|
|
46
|
-
e.detail.register(0, (processNextHandler) => {
|
|
47
|
-
this.nativeGoBack();
|
|
48
|
-
processNextHandler();
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
goBack(route, animationBuilder) {
|
|
52
|
-
this.props.onNavigateBack(route, animationBuilder);
|
|
53
|
-
}
|
|
54
|
-
nativeGoBack() {
|
|
55
|
-
this.props.onNativeBack();
|
|
56
|
-
}
|
|
57
|
-
navigate(path, direction = "forward", action = "push", animationBuilder, options, tab) {
|
|
58
|
-
this.props.onNavigate(path, action, direction, animationBuilder, options, tab);
|
|
59
|
-
}
|
|
60
|
-
getPageManager() {
|
|
61
|
-
return PageManager;
|
|
62
|
-
}
|
|
63
|
-
getIonRedirect() {
|
|
64
|
-
return this.props.ionRedirect;
|
|
65
|
-
}
|
|
66
|
-
getIonRoute() {
|
|
67
|
-
return this.props.ionRoute;
|
|
68
|
-
}
|
|
69
|
-
getStackManager() {
|
|
70
|
-
return this.props.stackManager;
|
|
71
|
-
}
|
|
72
|
-
render() {
|
|
73
|
-
return /* @__PURE__ */ React.createElement(NavContext.Provider, { value: { ...this.state, routeInfo: this.props.routeInfo } }, /* @__PURE__ */ React.createElement(IonRouterContext.Provider, { value: { ...this.ionRouterContextValue, routeInfo: this.props.routeInfo } }, this.props.children));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=NavManager.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/routing/NavManager.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { AnimationBuilder } from '@ionic/core/components';\nimport React from 'react';\n\nimport type { IonRouterContextState } from '../components/IonRouterContext';\nimport { IonRouterContext } from '../components/IonRouterContext';\nimport type { NavContextState } from '../contexts/NavContext';\nimport { NavContext } from '../contexts/NavContext';\nimport type { RouteAction } from '../models/RouteAction';\nimport type { RouteInfo } from '../models/RouteInfo';\nimport type { RouterDirection } from '../models/RouterDirection';\nimport type { RouterOptions } from '../models/RouterOptions';\n\nimport type { LocationHistory } from './LocationHistory';\nimport PageManager from './PageManager';\n\n// TODO(FW-2959): types\n\ninterface NavManagerProps {\n routeInfo: RouteInfo;\n onNativeBack: () => void;\n onNavigateBack: (route?: string | RouteInfo, animationBuilder?: AnimationBuilder) => void;\n onNavigate: (\n path: string,\n action: RouteAction,\n direction?: RouterDirection,\n animationBuilder?: AnimationBuilder,\n options?: any,\n tab?: string\n ) => void;\n onSetCurrentTab: (tab: string, routeInfo: RouteInfo) => void;\n onChangeTab: (tab: string, path: string, routeOptions?: any) => void;\n onResetTab: (tab: string, path: string, routeOptions?: any) => void;\n ionRedirect: any;\n ionRoute: any;\n stackManager: any;\n locationHistory: LocationHistory;\n}\n\nexport class NavManager extends React.PureComponent<NavManagerProps, NavContextState> {\n ionRouterContextValue: IonRouterContextState = {\n push: (\n pathname: string,\n routerDirection?: RouterDirection,\n routeAction?: RouteAction,\n routerOptions?: RouterOptions,\n animationBuilder?: AnimationBuilder\n ) => {\n this.navigate(pathname, routerDirection, routeAction, animationBuilder, routerOptions);\n },\n back: (animationBuilder?: AnimationBuilder) => {\n this.goBack(undefined, animationBuilder);\n },\n canGoBack: () => this.props.locationHistory.canGoBack(),\n nativeBack: () => this.props.onNativeBack(),\n routeInfo: this.props.routeInfo,\n };\n\n constructor(props: NavManagerProps) {\n super(props);\n this.state = {\n goBack: this.goBack.bind(this),\n hasIonicRouter: () => true,\n navigate: this.navigate.bind(this),\n getIonRedirect: this.getIonRedirect.bind(this),\n getIonRoute: this.getIonRoute.bind(this),\n getStackManager: this.getStackManager.bind(this),\n getPageManager: this.getPageManager.bind(this),\n routeInfo: this.props.routeInfo,\n setCurrentTab: this.props.onSetCurrentTab,\n changeTab: this.props.onChangeTab,\n resetTab: this.props.onResetTab,\n };\n }\n\n componentDidMount() {\n if (typeof document !== 'undefined') {\n this.handleHardwareBackButton = this.handleHardwareBackButton.bind(this);\n document.addEventListener('ionBackButton', this.handleHardwareBackButton);\n }\n }\n\n componentWillUnmount() {\n if (typeof document !== 'undefined') {\n document.removeEventListener('ionBackButton', this.handleHardwareBackButton);\n }\n }\n\n handleHardwareBackButton(e: any) {\n e.detail.register(0, (processNextHandler: () => void) => {\n this.nativeGoBack();\n processNextHandler();\n });\n }\n\n goBack(route?: string | RouteInfo, animationBuilder?: AnimationBuilder) {\n this.props.onNavigateBack(route, animationBuilder);\n }\n\n nativeGoBack() {\n this.props.onNativeBack();\n }\n\n navigate(\n path: string,\n direction: RouterDirection = 'forward',\n action: RouteAction = 'push',\n animationBuilder?: AnimationBuilder,\n options?: any,\n tab?: string\n ) {\n this.props.onNavigate(path, action, direction, animationBuilder, options, tab);\n }\n\n getPageManager() {\n return PageManager;\n }\n\n getIonRedirect() {\n return this.props.ionRedirect;\n }\n\n getIonRoute() {\n return this.props.ionRoute;\n }\n\n getStackManager() {\n return this.props.stackManager;\n }\n\n render() {\n return (\n <NavContext.Provider value={{ ...this.state, routeInfo: this.props.routeInfo }}>\n <IonRouterContext.Provider value={{ ...this.ionRouterContextValue, routeInfo: this.props.routeInfo }}>\n {this.props.children}\n </IonRouterContext.Provider>\n </NavContext.Provider>\n );\n }\n}\n"],
|
|
5
|
-
"mappings": ";AACA,OAAO,WAAW;AAGlB,SAAS,wBAAwB;AAEjC,SAAS,kBAAkB;AAO3B,OAAO,iBAAiB;AAyB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