expo-router 6.0.0-beta.0 → 6.0.0-beta.10
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/assets/modal.module.css +15 -14
- package/assets/native-tabs.module.css +109 -0
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +0 -2
- package/build/ExpoRoot.js.map +1 -1
- package/build/fork/NavigationContainer.d.ts.map +1 -1
- package/build/fork/NavigationContainer.js +2 -0
- package/build/fork/NavigationContainer.js.map +1 -1
- package/build/fork/extractPathFromURL.d.ts.map +1 -1
- package/build/fork/extractPathFromURL.js +4 -0
- package/build/fork/extractPathFromURL.js.map +1 -1
- package/build/fork/getPathFromState.d.ts.map +1 -1
- package/build/fork/getPathFromState.js +2 -0
- package/build/fork/getPathFromState.js.map +1 -1
- package/build/global-state/routing.d.ts +6 -5
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +20 -14
- package/build/global-state/routing.js.map +1 -1
- package/build/head/ExpoHead.android.d.ts +1 -3
- package/build/imperative-api.d.ts +3 -1
- package/build/imperative-api.d.ts.map +1 -1
- package/build/imperative-api.js +4 -4
- package/build/imperative-api.js.map +1 -1
- package/build/layouts/DrawerClient.d.ts +2 -12
- package/build/layouts/DrawerClient.d.ts.map +1 -1
- package/build/layouts/StackClient.d.ts +14 -19
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js +27 -25
- package/build/layouts/StackClient.js.map +1 -1
- package/build/layouts/TabsClient.d.ts +3 -18
- package/build/layouts/TabsClient.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.d.ts +5 -1
- package/build/layouts/withLayoutContext.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.js +19 -6
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/ExpoLink.d.ts.map +1 -1
- package/build/link/ExpoLink.js +4 -1
- package/build/link/ExpoLink.js.map +1 -1
- package/build/link/LinkWithPreview.d.ts.map +1 -1
- package/build/link/LinkWithPreview.js +19 -24
- package/build/link/LinkWithPreview.js.map +1 -1
- package/build/link/elements.d.ts +2 -10
- package/build/link/elements.d.ts.map +1 -1
- package/build/link/elements.js +1 -1
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/native.d.ts +0 -2
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js +1 -11
- package/build/link/preview/native.js.map +1 -1
- package/build/link/preview/utils.d.ts.map +1 -1
- package/build/link/preview/utils.js +5 -2
- package/build/link/preview/utils.js.map +1 -1
- package/build/modal/web/ModalStackRouteDrawer.js +9 -10
- package/build/modal/web/ModalStackRouteDrawer.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js +61 -9
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js +6 -27
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts +11 -3
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js +154 -62
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts +3 -2
- package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.d.ts +24 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.js +28 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +114 -38
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.d.ts +4 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js +158 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/appearance.d.ts +20 -0
- package/build/native-tabs/NativeBottomTabs/appearance.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/appearance.js +119 -0
- package/build/native-tabs/NativeBottomTabs/appearance.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/types.d.ts +312 -46
- package/build/native-tabs/NativeBottomTabs/types.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/types.js +51 -0
- package/build/native-tabs/NativeBottomTabs/types.js.map +1 -1
- package/build/native-tabs/common/elements.d.ts +84 -21
- package/build/native-tabs/common/elements.d.ts.map +1 -1
- package/build/native-tabs/common/elements.js +23 -0
- package/build/native-tabs/common/elements.js.map +1 -1
- package/build/native-tabs/index.d.ts +2 -1
- package/build/native-tabs/index.d.ts.map +1 -1
- package/build/native-tabs/index.js +3 -1
- package/build/native-tabs/index.js.map +1 -1
- package/build/navigationParams.d.ts +9 -0
- package/build/navigationParams.d.ts.map +1 -0
- package/build/navigationParams.js +67 -0
- package/build/navigationParams.js.map +1 -0
- package/build/rsc/router/client.d.ts +1 -3
- package/build/rsc/router/client.d.ts.map +1 -1
- package/build/testing-library/index.d.ts +15 -4
- package/build/testing-library/index.d.ts.map +1 -1
- package/build/testing-library/index.js +31 -28
- package/build/testing-library/index.js.map +1 -1
- package/build/testing-library/mocks.js +0 -7
- package/build/testing-library/mocks.js.map +1 -1
- package/build/typed-routes/generate.d.ts +2 -1
- package/build/typed-routes/generate.d.ts.map +1 -1
- package/build/typed-routes/generate.js +3 -1
- package/build/typed-routes/generate.js.map +1 -1
- package/build/ui/Slot.d.ts +5 -1
- package/build/ui/Slot.d.ts.map +1 -1
- package/build/ui/Slot.js.map +1 -1
- package/build/ui/TabContext.d.ts +11 -21
- package/build/ui/TabContext.d.ts.map +1 -1
- package/build/ui/TabRouter.d.ts +7 -0
- package/build/ui/TabRouter.d.ts.map +1 -1
- package/build/ui/Tabs.d.ts +14 -23
- package/build/ui/Tabs.d.ts.map +1 -1
- package/build/ui/Tabs.js +1 -1
- package/build/ui/Tabs.js.map +1 -1
- package/build/ui/common.d.ts +2 -3
- package/build/ui/common.d.ts.map +1 -1
- package/build/ui/common.js +1 -3
- package/build/ui/common.js.map +1 -1
- package/build/useFocusEffect.js +1 -1
- package/build/useFocusEffect.js.map +1 -1
- package/build/useScreens.d.ts +1 -1
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +6 -4
- package/build/useScreens.js.map +1 -1
- package/ios/ExpoHead.podspec +2 -0
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +7 -9
- package/ios/LinkPreview/LinkPreviewNativeView.swift +13 -28
- package/package.json +22 -24
- package/plugin/build/index.js +1 -1
- package/plugin/src/index.ts +1 -1
- package/ios/LinkPreview/LinkPreviewNativeTriggerView.swift +0 -9
- package/plugin/tsconfig.tsbuildinfo +0 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { ImageSourcePropType } from 'react-native';
|
|
1
|
+
import type { ColorValue, ImageSourcePropType } from 'react-native';
|
|
2
2
|
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
3
|
+
import type { NativeTabsLabelStyle } from '../NativeBottomTabs/types';
|
|
3
4
|
export interface LabelProps {
|
|
4
5
|
/**
|
|
5
6
|
* The text to display as the label for the tab.
|
|
6
7
|
*/
|
|
7
8
|
children?: string;
|
|
9
|
+
selectedStyle?: NativeTabsLabelStyle;
|
|
8
10
|
/**
|
|
9
11
|
* If true, the label will be hidden.
|
|
10
12
|
* @default false
|
|
@@ -15,42 +17,65 @@ export declare function Label(props: LabelProps): null;
|
|
|
15
17
|
export interface SourceIconCombination {
|
|
16
18
|
/**
|
|
17
19
|
* The image source to use as an icon.
|
|
20
|
+
*
|
|
21
|
+
* The value can be provided in two ways:
|
|
22
|
+
* - As an image source
|
|
23
|
+
* - As an object specifying the default and selected states
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <Icon src={require('./path/to/icon.png')} />
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Icon src={{ default: require('./path/to/icon.png'), selected: require('./path/to/icon-selected.png') }} />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @platform Android
|
|
18
36
|
* @platform iOS
|
|
19
37
|
*/
|
|
20
|
-
src?: ImageSourcePropType
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
selectedSrc?: ImageSourcePropType;
|
|
26
|
-
/**
|
|
27
|
-
* The name of the drawable resource to use as an icon.
|
|
28
|
-
* @platform android
|
|
29
|
-
*/
|
|
30
|
-
drawable?: string;
|
|
38
|
+
src?: ImageSourcePropType | React.ReactElement | {
|
|
39
|
+
default?: ImageSourcePropType | React.ReactElement;
|
|
40
|
+
selected: ImageSourcePropType | React.ReactElement;
|
|
41
|
+
};
|
|
42
|
+
drawable?: never;
|
|
31
43
|
sf?: never;
|
|
32
|
-
selectedSf?: never;
|
|
33
44
|
}
|
|
34
45
|
export interface NamedIconCombination {
|
|
35
46
|
/**
|
|
36
47
|
* The name of the SF Symbol to use as an icon.
|
|
48
|
+
*
|
|
49
|
+
* The value can be provided in two ways:
|
|
50
|
+
* - As a string with the SF Symbol name
|
|
51
|
+
* - As an object specifying the default and selected states
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* <Icon sf="magnifyingglass" />
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <Icon sf={{ default: "house", selected: "house.fill" }} />
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
37
63
|
* @platform iOS
|
|
38
64
|
*/
|
|
39
|
-
sf?: SFSymbol
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*/
|
|
44
|
-
selectedSf?: SFSymbol;
|
|
65
|
+
sf?: SFSymbol | {
|
|
66
|
+
default?: SFSymbol;
|
|
67
|
+
selected: SFSymbol;
|
|
68
|
+
};
|
|
45
69
|
/**
|
|
46
70
|
* The name of the drawable resource to use as an icon.
|
|
47
71
|
* @platform android
|
|
48
72
|
*/
|
|
49
73
|
drawable?: string;
|
|
50
74
|
src?: never;
|
|
51
|
-
selectedSrc?: never;
|
|
52
75
|
}
|
|
53
|
-
export type IconProps =
|
|
76
|
+
export type IconProps = {
|
|
77
|
+
selectedColor?: ColorValue;
|
|
78
|
+
} & (NamedIconCombination | SourceIconCombination);
|
|
54
79
|
/**
|
|
55
80
|
* Renders an icon for the tab.
|
|
56
81
|
*
|
|
@@ -58,6 +83,43 @@ export type IconProps = NamedIconCombination | SourceIconCombination;
|
|
|
58
83
|
* @platform android
|
|
59
84
|
*/
|
|
60
85
|
export declare function Icon(props: IconProps): null;
|
|
86
|
+
export interface VectorIconProps<NameT extends string> {
|
|
87
|
+
/**
|
|
88
|
+
* The family of the vector icon.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
family: {
|
|
96
|
+
getImageSource: (name: NameT, size: number, color: ColorValue) => Promise<ImageSourcePropType>;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* The name of the vector icon.
|
|
100
|
+
*/
|
|
101
|
+
name: NameT;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Helper component which can be used to load vector icons for `NativeTabs`.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```tsx
|
|
108
|
+
* import { NativeTabs, VectorIcon } from 'expo-router';
|
|
109
|
+
* import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
|
|
110
|
+
*
|
|
111
|
+
* export default Layout(){
|
|
112
|
+
* return (
|
|
113
|
+
* <NativeTabs>
|
|
114
|
+
* <NativeTabs.Trigger name="index">
|
|
115
|
+
* <Icon src={<VectorIcon family={MaterialCommunityIcons} name="home" />} />
|
|
116
|
+
* </NativeTabs.Trigger>
|
|
117
|
+
* </NativeTabs>
|
|
118
|
+
* );
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare function VectorIcon<NameT extends string>(props: VectorIconProps<NameT>): null;
|
|
61
123
|
export interface BadgeProps {
|
|
62
124
|
/**
|
|
63
125
|
* The text to display as the badge for the tab.
|
|
@@ -69,6 +131,7 @@ export interface BadgeProps {
|
|
|
69
131
|
* @default false
|
|
70
132
|
*/
|
|
71
133
|
hidden?: boolean;
|
|
134
|
+
selectedBackgroundColor?: ColorValue;
|
|
72
135
|
}
|
|
73
136
|
export declare function Badge(props: BadgeProps): null;
|
|
74
137
|
//# sourceMappingURL=elements.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/common/elements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,CAAC,KAAK,SAAS,MAAM;IACnD;;;;;;;OAOG;IACH,MAAM,EAAE;QACN,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;KAChG,CAAC;IACF;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,QAE7E;AAED,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uBAAuB,CAAC,EAAE,UAAU,CAAC;CACtC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,QAEtC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Label = Label;
|
|
4
4
|
exports.Icon = Icon;
|
|
5
|
+
exports.VectorIcon = VectorIcon;
|
|
5
6
|
exports.Badge = Badge;
|
|
6
7
|
function Label(props) {
|
|
7
8
|
return null;
|
|
@@ -15,6 +16,28 @@ function Label(props) {
|
|
|
15
16
|
function Icon(props) {
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Helper component which can be used to load vector icons for `NativeTabs`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* import { NativeTabs, VectorIcon } from 'expo-router';
|
|
25
|
+
* import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
|
|
26
|
+
*
|
|
27
|
+
* export default Layout(){
|
|
28
|
+
* return (
|
|
29
|
+
* <NativeTabs>
|
|
30
|
+
* <NativeTabs.Trigger name="index">
|
|
31
|
+
* <Icon src={<VectorIcon family={MaterialCommunityIcons} name="home" />} />
|
|
32
|
+
* </NativeTabs.Trigger>
|
|
33
|
+
* </NativeTabs>
|
|
34
|
+
* );
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function VectorIcon(props) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
18
41
|
function Badge(props) {
|
|
19
42
|
return null;
|
|
20
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":";;AAkBA,sBAEC;AA0ED,oBAEC;AAuCD,gCAEC;AAiBD,sBAEC;AA1ID,SAAgB,KAAK,CAAC,KAAiB;IACrC,OAAO,IAAI,CAAC;AACd,CAAC;AAoED;;;;;GAKG;AACH,SAAgB,IAAI,CAAC,KAAgB;IACnC,OAAO,IAAI,CAAC;AACd,CAAC;AAoBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,UAAU,CAAuB,KAA6B;IAC5E,OAAO,IAAI,CAAC;AACd,CAAC;AAiBD,SAAgB,KAAK,CAAC,KAAiB;IACrC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { ColorValue, ImageSourcePropType } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport type { NativeTabsLabelStyle } from '../NativeBottomTabs/types';\n\nexport interface LabelProps {\n /**\n * The text to display as the label for the tab.\n */\n children?: string;\n selectedStyle?: NativeTabsLabelStyle;\n /**\n * If true, the label will be hidden.\n * @default false\n */\n hidden?: boolean;\n}\n\nexport function Label(props: LabelProps) {\n return null;\n}\n\nexport interface SourceIconCombination {\n /**\n * The image source to use as an icon.\n *\n * The value can be provided in two ways:\n * - As an image source\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon src={require('./path/to/icon.png')} />\n * ```\n *\n * @example\n * ```tsx\n * <Icon src={{ default: require('./path/to/icon.png'), selected: require('./path/to/icon-selected.png') }} />\n * ```\n *\n * @platform Android\n * @platform iOS\n */\n src?:\n | ImageSourcePropType\n | React.ReactElement\n | {\n default?: ImageSourcePropType | React.ReactElement;\n selected: ImageSourcePropType | React.ReactElement;\n };\n drawable?: never;\n sf?: never;\n}\n\nexport interface NamedIconCombination {\n /**\n * The name of the SF Symbol to use as an icon.\n *\n * The value can be provided in two ways:\n * - As a string with the SF Symbol name\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon sf=\"magnifyingglass\" />\n * ```\n *\n * @example\n * ```tsx\n * <Icon sf={{ default: \"house\", selected: \"house.fill\" }} />\n * ```\n *\n * @platform iOS\n */\n sf?: SFSymbol | { default?: SFSymbol; selected: SFSymbol };\n /**\n * The name of the drawable resource to use as an icon.\n * @platform android\n */\n drawable?: string;\n src?: never;\n}\n\nexport type IconProps = { selectedColor?: ColorValue } & (\n | NamedIconCombination\n | SourceIconCombination\n);\n\n/**\n * Renders an icon for the tab.\n *\n * @platform ios\n * @platform android\n */\nexport function Icon(props: IconProps) {\n return null;\n}\n\nexport interface VectorIconProps<NameT extends string> {\n /**\n * The family of the vector icon.\n *\n * @example\n * ```tsx\n * import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';\n * ```\n */\n family: {\n getImageSource: (name: NameT, size: number, color: ColorValue) => Promise<ImageSourcePropType>;\n };\n /**\n * The name of the vector icon.\n */\n name: NameT;\n}\n\n/**\n * Helper component which can be used to load vector icons for `NativeTabs`.\n *\n * @example\n * ```tsx\n * import { NativeTabs, VectorIcon } from 'expo-router';\n * import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';\n *\n * export default Layout(){\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"index\">\n * <Icon src={<VectorIcon family={MaterialCommunityIcons} name=\"home\" />} />\n * </NativeTabs.Trigger>\n * </NativeTabs>\n * );\n * }\n * ```\n */\nexport function VectorIcon<NameT extends string>(props: VectorIconProps<NameT>) {\n return null;\n}\n\nexport interface BadgeProps {\n /**\n * The text to display as the badge for the tab.\n * If not provided, the badge will not be displayed.\n */\n children?: string;\n\n /**\n * If true, the badge will be hidden.\n * @default false\n */\n hidden?: boolean;\n selectedBackgroundColor?: ColorValue;\n}\n\nexport function Badge(props: BadgeProps) {\n return null;\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './common/elements';
|
|
2
|
-
export type { NativeTabsProps, NativeTabTriggerProps,
|
|
2
|
+
export type { NativeTabsProps, NativeTabTriggerProps, NativeTabsLabelStyle, NativeTabsActiveStyleType, NativeTabOptions, SymbolOrImageSource, NativeTabsTabBarItemLabelVisibilityMode, NativeTabsBlurEffect, NativeTabsTabBarMinimizeBehavior, NativeTabsTabBarItemRole, NativeTabsTriggerTabBarProps, } from './NativeBottomTabs/types';
|
|
3
|
+
export { NativeTabsTriggerTabBar } from './NativeBottomTabs/NativeTabsTriggerTabBar';
|
|
3
4
|
export { NativeTabTrigger } from './NativeBottomTabs/NativeTabTrigger';
|
|
4
5
|
export { NativeTabs } from './NativeBottomTabs/NativeTabs';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,uCAAuC,EACvC,oBAAoB,EACpB,gCAAgC,EAChC,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -14,8 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.NativeTabs = exports.NativeTabTrigger = void 0;
|
|
17
|
+
exports.NativeTabs = exports.NativeTabTrigger = exports.NativeTabsTriggerTabBar = void 0;
|
|
18
18
|
__exportStar(require("./common/elements"), exports);
|
|
19
|
+
var NativeTabsTriggerTabBar_1 = require("./NativeBottomTabs/NativeTabsTriggerTabBar");
|
|
20
|
+
Object.defineProperty(exports, "NativeTabsTriggerTabBar", { enumerable: true, get: function () { return NativeTabsTriggerTabBar_1.NativeTabsTriggerTabBar; } });
|
|
19
21
|
var NativeTabTrigger_1 = require("./NativeBottomTabs/NativeTabTrigger");
|
|
20
22
|
Object.defineProperty(exports, "NativeTabTrigger", { enumerable: true, get: function () { return NativeTabTrigger_1.NativeTabTrigger; } });
|
|
21
23
|
var NativeTabs_1 = require("./NativeBottomTabs/NativeTabs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAkC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAkC;AAclC,sFAAqF;AAA5E,kIAAA,uBAAuB,OAAA;AAChC,wEAAuE;AAA9D,oHAAA,gBAAgB,OAAA;AACzB,4DAA2D;AAAlD,wGAAA,UAAU,OAAA","sourcesContent":["export * from './common/elements';\nexport type {\n NativeTabsProps,\n NativeTabTriggerProps,\n NativeTabsLabelStyle,\n NativeTabsActiveStyleType,\n NativeTabOptions,\n SymbolOrImageSource,\n NativeTabsTabBarItemLabelVisibilityMode,\n NativeTabsBlurEffect,\n NativeTabsTabBarMinimizeBehavior,\n NativeTabsTabBarItemRole,\n NativeTabsTriggerTabBarProps,\n} from './NativeBottomTabs/types';\nexport { NativeTabsTriggerTabBar } from './NativeBottomTabs/NativeTabsTriggerTabBar';\nexport { NativeTabTrigger } from './NativeBottomTabs/NativeTabTrigger';\nexport { NativeTabs } from './NativeBottomTabs/NativeTabs';\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const internalExpoRouterParamNames: readonly ["__internal_expo_router_no_animation", "__internal__expo_router_is_preview_navigation"];
|
|
2
|
+
export type InternalExpoRouterParamName = (typeof internalExpoRouterParamNames)[number];
|
|
3
|
+
export type InternalExpoRouterParams = Partial<Record<InternalExpoRouterParamName, unknown>>;
|
|
4
|
+
export declare function appendInternalExpoRouterParams(params: Record<string, unknown> | object | undefined, expoParams: InternalExpoRouterParams): Record<string, unknown> | undefined;
|
|
5
|
+
export declare function getInternalExpoRouterParams(_params: Record<string, unknown> | object | undefined): InternalExpoRouterParams;
|
|
6
|
+
export declare function removeInternalExpoRouterParams(params: Record<string, unknown> | object): Record<string, unknown> | object;
|
|
7
|
+
export declare function removeInternalExpoRouterParams(params: Record<string, unknown> | object | undefined): Record<string, unknown> | object | undefined;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=navigationParams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigationParams.d.ts","sourceRoot":"","sources":["../src/navigationParams.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,4BAA4B,mGAGxB,CAAC;AAEX,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC;AACxF,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC,CAAC;AAE7F,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,EACpD,UAAU,EAAE,wBAAwB,uCAyBrC;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,GACpD,wBAAwB,CAiB1B;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GACvC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;AACpC,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,GACnD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appendInternalExpoRouterParams = appendInternalExpoRouterParams;
|
|
4
|
+
exports.getInternalExpoRouterParams = getInternalExpoRouterParams;
|
|
5
|
+
exports.removeInternalExpoRouterParams = removeInternalExpoRouterParams;
|
|
6
|
+
const INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME = '__internal_expo_router_no_animation';
|
|
7
|
+
const INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME = '__internal__expo_router_is_preview_navigation';
|
|
8
|
+
const internalExpoRouterParamNames = [
|
|
9
|
+
INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,
|
|
10
|
+
INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME,
|
|
11
|
+
];
|
|
12
|
+
function appendInternalExpoRouterParams(params, expoParams) {
|
|
13
|
+
let newParams = {};
|
|
14
|
+
// Using nested params is a workaround for the issue with the preview key not being passed to the params
|
|
15
|
+
// https://github.com/Ubax/react-navigation/blob/main/packages/core/src/useNavigationBuilder.tsx#L573
|
|
16
|
+
// Another solution would be to propagate the preview key in the useNavigationBuilder,
|
|
17
|
+
// but that would require us to fork the @react-navigation/core package.
|
|
18
|
+
let nestedParams = {};
|
|
19
|
+
if (params) {
|
|
20
|
+
newParams = { ...params };
|
|
21
|
+
if ('params' in params) {
|
|
22
|
+
if (typeof params.params === 'object' && params.params) {
|
|
23
|
+
nestedParams = params.params;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
nestedParams = { ...nestedParams, ...expoParams };
|
|
28
|
+
newParams = { ...newParams, ...expoParams };
|
|
29
|
+
if (Object.keys(nestedParams).length > 0) {
|
|
30
|
+
newParams.params = nestedParams;
|
|
31
|
+
}
|
|
32
|
+
if (Object.keys(newParams).length === 0 && params === undefined) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
return newParams;
|
|
36
|
+
}
|
|
37
|
+
function getInternalExpoRouterParams(_params) {
|
|
38
|
+
const expoParams = {};
|
|
39
|
+
const params = _params ? _params : {};
|
|
40
|
+
const nestedParams = 'params' in params && typeof params.params === 'object' && params.params
|
|
41
|
+
? params.params
|
|
42
|
+
: {};
|
|
43
|
+
for (const key of internalExpoRouterParamNames) {
|
|
44
|
+
if (key in params) {
|
|
45
|
+
expoParams[key] = params[key];
|
|
46
|
+
}
|
|
47
|
+
else if (key in nestedParams) {
|
|
48
|
+
expoParams[key] = nestedParams[key];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return expoParams;
|
|
52
|
+
}
|
|
53
|
+
function removeInternalExpoRouterParams(params) {
|
|
54
|
+
if (!params) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
const newNestedParams = 'params' in params && typeof params.params === 'object' && params.params
|
|
58
|
+
? Object.fromEntries(Object.entries(params.params).filter(([key]) => !internalExpoRouterParamNames.includes(key)))
|
|
59
|
+
: {};
|
|
60
|
+
const newParams = Object.fromEntries(Object.entries(params).filter(([key]) => !internalExpoRouterParamNames.includes(key) &&
|
|
61
|
+
key !== 'params'));
|
|
62
|
+
if (Object.keys(newNestedParams).length > 0) {
|
|
63
|
+
return { ...newParams, params: newNestedParams };
|
|
64
|
+
}
|
|
65
|
+
return newParams;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=navigationParams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigationParams.js","sourceRoot":"","sources":["../src/navigationParams.ts"],"names":[],"mappings":";;AAYA,wEA2BC;AAED,kEAmBC;AAQD,wEAyBC;AA7FD,MAAM,4CAA4C,GAAG,qCAAqC,CAAC;AAC3F,MAAM,qDAAqD,GACzD,+CAA+C,CAAC;AAElD,MAAM,4BAA4B,GAAG;IACnC,4CAA4C;IAC5C,qDAAqD;CAC7C,CAAC;AAKX,SAAgB,8BAA8B,CAC5C,MAAoD,EACpD,UAAoC;IAEpC,IAAI,SAAS,GAA4B,EAAE,CAAC;IAC5C,wGAAwG;IACxG,qGAAqG;IACrG,sFAAsF;IACtF,wEAAwE;IACxE,IAAI,YAAY,GAA4B,EAAE,CAAC;IAC/C,IAAI,MAAM,EAAE,CAAC;QACX,SAAS,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;QAC1B,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;YACvB,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBACvD,YAAY,GAAG,MAAM,CAAC,MAAiC,CAAC;YAC1D,CAAC;QACH,CAAC;IACH,CAAC;IACD,YAAY,GAA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AAe,GACnB,QAAQ,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM;QACtE,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAClC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,4BAA4B,CAAC,QAAQ,CAAC,GAAkC,CAAC,CACtF,CACF;QACH,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAClC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAC3B,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CACR,CAAC,4BAA4B,CAAC,QAAQ,CAAC,GAAkC,CAAC;QAC1E,GAAG,KAAK,QAAQ,CACnB,CACF,CAAC;IACF,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,OAAO,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IACnD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["const INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME = '__internal_expo_router_no_animation';\nconst INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME =\n '__internal__expo_router_is_preview_navigation';\n\nconst internalExpoRouterParamNames = [\n INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME,\n] as const;\n\nexport type InternalExpoRouterParamName = (typeof internalExpoRouterParamNames)[number];\nexport type InternalExpoRouterParams = Partial<Record<InternalExpoRouterParamName, unknown>>;\n\nexport function appendInternalExpoRouterParams(\n params: Record<string, unknown> | object | undefined,\n expoParams: InternalExpoRouterParams\n) {\n let newParams: Record<string, unknown> = {};\n // Using nested params is a workaround for the issue with the preview key not being passed to the params\n // https://github.com/Ubax/react-navigation/blob/main/packages/core/src/useNavigationBuilder.tsx#L573\n // Another solution would be to propagate the preview key in the useNavigationBuilder,\n // but that would require us to fork the @react-navigation/core package.\n let nestedParams: Record<string, unknown> = {};\n if (params) {\n newParams = { ...params };\n if ('params' in params) {\n if (typeof params.params === 'object' && params.params) {\n nestedParams = params.params as Record<string, unknown>;\n }\n }\n }\n nestedParams = { ...nestedParams, ...expoParams };\n newParams = { ...newParams, ...expoParams };\n if (Object.keys(nestedParams).length > 0) {\n newParams.params = nestedParams;\n }\n if (Object.keys(newParams).length === 0 && params === undefined) {\n return undefined;\n }\n return newParams;\n}\n\nexport function getInternalExpoRouterParams(\n _params: Record<string, unknown> | object | undefined\n): InternalExpoRouterParams {\n const expoParams: InternalExpoRouterParams = {};\n const params: Record<string, unknown> = _params ? (_params as Record<string, unknown>) : {};\n const nestedParams: Record<string, unknown> =\n 'params' in params && typeof params.params === 'object' && params.params\n ? (params.params as Record<string, unknown>)\n : {};\n\n for (const key of internalExpoRouterParamNames) {\n if (key in params) {\n expoParams[key] = params[key];\n } else if (key in nestedParams) {\n expoParams[key] = nestedParams[key];\n }\n }\n\n return expoParams;\n}\n\nexport function removeInternalExpoRouterParams(\n params: Record<string, unknown> | object\n): Record<string, unknown> | object;\nexport function removeInternalExpoRouterParams(\n params: Record<string, unknown> | object | undefined\n): Record<string, unknown> | object | undefined;\nexport function removeInternalExpoRouterParams(\n params: Record<string, unknown> | object | undefined\n): Record<string, unknown> | object | undefined {\n if (!params) {\n return undefined;\n }\n const newNestedParams =\n 'params' in params && typeof params.params === 'object' && params.params\n ? Object.fromEntries(\n Object.entries(params.params).filter(\n ([key]) => !internalExpoRouterParamNames.includes(key as InternalExpoRouterParamName)\n )\n )\n : {};\n const newParams = Object.fromEntries(\n Object.entries(params).filter(\n ([key]) =>\n !internalExpoRouterParamNames.includes(key as InternalExpoRouterParamName) &&\n key !== 'params'\n )\n );\n if (Object.keys(newNestedParams).length > 0) {\n return { ...newParams, params: newNestedParams };\n }\n return newParams;\n}\n"]}
|
|
@@ -55,9 +55,7 @@ export declare function Router({ routerData }: {
|
|
|
55
55
|
export declare function ServerRouter({ children, route }: {
|
|
56
56
|
children: ReactNode;
|
|
57
57
|
route: RouteProps;
|
|
58
|
-
}): import("react").FunctionComponentElement<
|
|
59
|
-
children?: ReactNode | undefined;
|
|
60
|
-
}>;
|
|
58
|
+
}): import("react").FunctionComponentElement<import("react").FragmentProps>;
|
|
61
59
|
export type LinkProps = ClassicLinkProps & {
|
|
62
60
|
href: string;
|
|
63
61
|
} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/rsc/router/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmBH,OAAO,KAAK,EAGV,SAAS,EAET,oBAAoB,EAGrB,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,KAAK,EAAE,MAAM,IAAI,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,IAAI,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGvF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AA+O3C,wBAAgB,kBAAkB,IAAI,qBAAqB,GACzD,UAAU,GAAG;IACX,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAChC,CA4FF;AAoDD,KAAK,UAAU,GAAG,CAAC,SAAS;IAC1B,MAAM;IACN,SAAS;QACP,OAAO;QACP,MAAM,EAAE;KACT;CACF,CAAC,EAAE,CAAC;AAGL,KAAK,UAAU,GAAG;IACh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AM,KAAK,IAAI,CAAC;CAC/D,CAAC;AAIF,wBAAgB,MAAM,CAAC,EAAE,UAAgC,EAAE;;CAAA;;;;;;;;;;;;;;;;;;gBAU1D;AAKD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,2EAgB3F;AAED,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG;IACzC,IAAI,EAAE,MAAM,CAAC;CAMd,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC;AAE1D,eAAO,MAAM,IAAI,EAA4C,aAAa,CAAC"}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import './expect';
|
|
2
2
|
import './mocks';
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { MockContextConfig, getMockConfig, getMockContext } from './mock-config';
|
|
5
5
|
import { ExpoLinkingOptions } from '../getLinkingConfig';
|
|
6
6
|
import { ReactNavigationState } from '../global-state/router-store';
|
|
7
|
-
|
|
8
|
-
export type
|
|
7
|
+
declare const rnTestingLibrary: typeof import("@testing-library/react-native");
|
|
8
|
+
export type * from '@testing-library/react-native';
|
|
9
|
+
export declare const act: typeof React.act, cleanup: typeof import("@testing-library/react-native").cleanup, fireEvent: typeof import("@testing-library/react-native").fireEvent, waitFor: typeof import("@testing-library/react-native").waitFor, waitForElementToBeRemoved: typeof import("@testing-library/react-native").waitForElementToBeRemoved, within: typeof import("@testing-library/react-native").within, configure: typeof import("@testing-library/react-native").configure, resetToDefaults: typeof import("@testing-library/react-native").resetToDefaults, isHiddenFromAccessibility: typeof import("@testing-library/react-native").isHiddenFromAccessibility, isInaccessible: typeof import("@testing-library/react-native").isHiddenFromAccessibility, getDefaultNormalizer: typeof import("@testing-library/react-native").getDefaultNormalizer, renderHook: typeof import("@testing-library/react-native").renderHook, userEvent: {
|
|
10
|
+
setup: typeof import("@testing-library/react-native/build/user-event/setup").setup;
|
|
11
|
+
press: (element: import("react-test-renderer").ReactTestInstance) => Promise<void>;
|
|
12
|
+
longPress: (element: import("react-test-renderer").ReactTestInstance, options?: import("@testing-library/react-native/build/user-event/press").PressOptions) => Promise<void>;
|
|
13
|
+
type: (element: import("react-test-renderer").ReactTestInstance, text: string, options?: import("@testing-library/react-native/build/user-event/type").TypeOptions) => Promise<void>;
|
|
14
|
+
clear: (element: import("react-test-renderer").ReactTestInstance) => Promise<void>;
|
|
15
|
+
paste: (element: import("react-test-renderer").ReactTestInstance, text: string) => Promise<void>;
|
|
16
|
+
scrollTo: (element: import("react-test-renderer").ReactTestInstance, options: import("@testing-library/react-native/build/user-event/scroll").ScrollToOptions) => Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
export declare let screen: typeof rnTestingLibrary.screen;
|
|
19
|
+
export type RenderRouterOptions = Parameters<typeof rnTestingLibrary.render>[1] & {
|
|
9
20
|
initialUrl?: any;
|
|
10
21
|
linking?: Partial<ExpoLinkingOptions>;
|
|
11
22
|
};
|
|
12
|
-
type Result = ReturnType<typeof render> & {
|
|
23
|
+
type Result = ReturnType<typeof rnTestingLibrary.render> & {
|
|
13
24
|
getPathname(): string;
|
|
14
25
|
getPathnameWithParams(): string;
|
|
15
26
|
getSegments(): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing-library/index.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAC;AAClB,OAAO,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing-library/index.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAC;AAClB,OAAO,SAAS,CAAC;AAGjB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CA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,MAAM,UAAU;IACrB,yDAAyD;mBAC1C,MAAM;IAIrB,yDAAyD;eAC9C,MAAM;IAIjB,6DAA6D;kBAC/C,MAAM;IAIpB,oDAAoD;gBACxC,MAAM;IAOlB,qEAAqE;;IAIrE,wEAAwE;sBACtD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,MAAM;IAMvD,qEAAqE;;CAItE,CAAC"}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
4
|
};
|
|
@@ -21,7 +7,6 @@ exports.testRouter = exports.getMockContext = exports.getMockConfig = void 0;
|
|
|
21
7
|
exports.renderRouter = renderRouter;
|
|
22
8
|
require("./expect");
|
|
23
9
|
require("./mocks");
|
|
24
|
-
const react_native_1 = require("@testing-library/react-native");
|
|
25
10
|
const react_1 = __importDefault(require("react"));
|
|
26
11
|
const mock_config_1 = require("./mock-config");
|
|
27
12
|
Object.defineProperty(exports, "getMockConfig", { enumerable: true, get: function () { return mock_config_1.getMockConfig; } });
|
|
@@ -29,14 +14,32 @@ Object.defineProperty(exports, "getMockContext", { enumerable: true, get: functi
|
|
|
29
14
|
const ExpoRoot_1 = require("../ExpoRoot");
|
|
30
15
|
const router_store_1 = require("../global-state/router-store");
|
|
31
16
|
const imperative_api_1 = require("../imperative-api");
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
const rnTestingLibrary = (() => {
|
|
18
|
+
try {
|
|
19
|
+
return require('@testing-library/react-native');
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if ('code' in error && error.code === 'MODULE_NOT_FOUND') {
|
|
23
|
+
const newError = new Error(`[expo-router/testing-library] "@testing-library/react-native" failed to import. You need to install it to use expo-router's testing library.`);
|
|
24
|
+
newError.stack = error.stack;
|
|
25
|
+
newError.cause = error;
|
|
26
|
+
throw newError;
|
|
27
|
+
}
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
31
|
+
Object.assign(exports, rnTestingLibrary);
|
|
32
|
+
Object.defineProperty(exports, 'screen', {
|
|
33
|
+
get() {
|
|
34
|
+
return rnTestingLibrary.screen;
|
|
35
|
+
},
|
|
36
|
+
});
|
|
34
37
|
function renderRouter(context = './app', { initialUrl = '/', linking, ...options } = {}) {
|
|
35
38
|
jest.useFakeTimers();
|
|
36
39
|
const mockContext = (0, mock_config_1.getMockContext)(context);
|
|
37
40
|
// Force the render to be synchronous
|
|
38
41
|
process.env.EXPO_ROUTER_IMPORT_MODE = 'sync';
|
|
39
|
-
const result =
|
|
42
|
+
const result = rnTestingLibrary.render(<ExpoRoot_1.ExpoRoot context={mockContext} location={initialUrl} linking={linking}/>, options);
|
|
40
43
|
/**
|
|
41
44
|
* This is a hack to ensure that React Navigation's state updates are processed before we run assertions.
|
|
42
45
|
* Some updates are async and we need to wait for them to complete, otherwise will we get a false positive.
|
|
@@ -63,25 +66,25 @@ function renderRouter(context = './app', { initialUrl = '/', linking, ...options
|
|
|
63
66
|
exports.testRouter = {
|
|
64
67
|
/** Navigate to the provided pathname and the pathname */
|
|
65
68
|
navigate(path) {
|
|
66
|
-
|
|
67
|
-
expect(
|
|
69
|
+
rnTestingLibrary.act(() => imperative_api_1.router.navigate(path));
|
|
70
|
+
expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);
|
|
68
71
|
},
|
|
69
72
|
/** Push the provided pathname and assert the pathname */
|
|
70
73
|
push(path) {
|
|
71
|
-
|
|
72
|
-
expect(
|
|
74
|
+
rnTestingLibrary.act(() => imperative_api_1.router.push(path));
|
|
75
|
+
expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);
|
|
73
76
|
},
|
|
74
77
|
/** Replace with provided pathname and assert the pathname */
|
|
75
78
|
replace(path) {
|
|
76
|
-
|
|
77
|
-
expect(
|
|
79
|
+
rnTestingLibrary.act(() => imperative_api_1.router.replace(path));
|
|
80
|
+
expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);
|
|
78
81
|
},
|
|
79
82
|
/** Go back in history and asset the new pathname */
|
|
80
83
|
back(path) {
|
|
81
84
|
expect(imperative_api_1.router.canGoBack()).toBe(true);
|
|
82
|
-
|
|
85
|
+
rnTestingLibrary.act(() => imperative_api_1.router.back());
|
|
83
86
|
if (path) {
|
|
84
|
-
expect(
|
|
87
|
+
expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);
|
|
85
88
|
}
|
|
86
89
|
},
|
|
87
90
|
/** If there's history that supports invoking the `back` function. */
|
|
@@ -92,12 +95,12 @@ exports.testRouter = {
|
|
|
92
95
|
setParams(params, path) {
|
|
93
96
|
imperative_api_1.router.setParams(params);
|
|
94
97
|
if (path) {
|
|
95
|
-
expect(
|
|
98
|
+
expect(exports.screen).toHavePathnameWithParams(path);
|
|
96
99
|
}
|
|
97
100
|
},
|
|
98
101
|
/** If there's history that supports invoking the `back` function. */
|
|
99
102
|
dismissAll() {
|
|
100
|
-
|
|
103
|
+
rnTestingLibrary.act(() => imperative_api_1.router.dismissAll());
|
|
101
104
|
},
|
|
102
105
|
};
|
|
103
106
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing-library/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing-library/index.tsx"],"names":[],"mappings":";;;;;;AAuEA,oCAsCC;AA7GD,oBAAkB;AAClB,mBAAiB;AAGjB,kDAA0B;AAE1B,+CAAiF;AA+DrD,8FA/DA,2BAAa,OA+DA;AAAE,+FA/DA,4BAAc,OA+DA;AA9DzD,0CAAuC;AAEvC,+DAA2E;AAC3E,sDAA2C;AAE3C,MAAM,gBAAgB,GAAG,CAAC,GAAmD,EAAE;IAC7E,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YACzD,MAAM,QAAQ,GAAG,IAAI,KAAK,CACxB,8IAA8I,CAC/I,CAAC;YACF,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YAC7B,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;YACvB,MAAM,QAAQ,CAAC;QACjB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC,EAAE,CAAC;AAuBL,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACzC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE;IACvC,GAAG;QACD,OAAO,gBAAgB,CAAC,MAAM,CAAC;IACjC,CAAC;CACF,CAAC,CAAC;AAiBH,SAAgB,YAAY,CAC1B,UAA6B,OAAO,EACpC,EAAE,UAAU,GAAG,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,KAA0B,EAAE;IAEnE,IAAI,CAA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MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IACD,6DAA6D;IAC7D,OAAO,CAAC,IAAY;QAClB,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,uBAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IACD,oDAAoD;IACpD,IAAI,CAAC,IAAa;QAChB,MAAM,CAAC,uBAAM,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,uBAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1C,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IACD,qEAAqE;IACrE,SAAS;QACP,OAAO,uBAAM,CAAC,SAAS,EAAE,CAAC;IAC5B,CAAC;IACD,wEAAwE;IACxE,SAAS,CAAC,MAA8B,EAAE,IAAa;QACrD,uBAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,cAAM,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,qEAAqE;IACrE,UAAU;QACR,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,uBAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAClD,CAAC;CACF,CAAC","sourcesContent":["import './expect';\nimport './mocks';\n\nimport type { RenderResult } from '@testing-library/react-native';\nimport React from 'react';\n\nimport { MockContextConfig, getMockConfig, getMockContext } from './mock-config';\nimport { ExpoRoot } from '../ExpoRoot';\nimport { ExpoLinkingOptions } from '../getLinkingConfig';\nimport { ReactNavigationState, store } from '../global-state/router-store';\nimport { router } from '../imperative-api';\n\nconst rnTestingLibrary = ((): typeof import('@testing-library/react-native') => {\n try {\n return require('@testing-library/react-native');\n } catch (error: any) {\n if ('code' in error && error.code === 'MODULE_NOT_FOUND') {\n const newError = new Error(\n `[expo-router/testing-library] \"@testing-library/react-native\" failed to import. You need to install it to use expo-router's testing library.`\n );\n newError.stack = error.stack;\n newError.cause = error;\n throw newError;\n }\n throw error;\n }\n})();\n\nexport type * from '@testing-library/react-native';\n\n// TODO(@kitten): This is for backwards-compatibility. Consider removing this!\nexport declare const {\n act,\n cleanup,\n fireEvent,\n waitFor,\n waitForElementToBeRemoved,\n within,\n configure,\n resetToDefaults,\n isHiddenFromAccessibility,\n isInaccessible,\n getDefaultNormalizer,\n renderHook,\n userEvent,\n}: typeof rnTestingLibrary;\n\nexport declare let screen: typeof rnTestingLibrary.screen;\n\nObject.assign(exports, rnTestingLibrary);\nObject.defineProperty(exports, 'screen', {\n get() {\n return rnTestingLibrary.screen;\n },\n});\n\nexport type RenderRouterOptions = Parameters<typeof rnTestingLibrary.render>[1] & {\n initialUrl?: any;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\ntype Result = ReturnType<typeof rnTestingLibrary.render> & {\n getPathname(): string;\n getPathnameWithParams(): string;\n getSegments(): string[];\n getSearchParams(): Record<string, string | string[]>;\n getRouterState(): ReactNavigationState | undefined;\n};\n\nexport { MockContextConfig, getMockConfig, getMockContext };\n\nexport function renderRouter(\n context: MockContextConfig = './app',\n { initialUrl = '/', linking, ...options }: RenderRouterOptions = {}\n): Result {\n jest.useFakeTimers();\n\n const mockContext = getMockContext(context);\n\n // Force the render to be synchronous\n process.env.EXPO_ROUTER_IMPORT_MODE = 'sync';\n\n const result = rnTestingLibrary.render(\n <ExpoRoot context={mockContext} location={initialUrl} linking={linking} />,\n options\n );\n\n /**\n * This is a hack to ensure that React Navigation's state updates are processed before we run assertions.\n * Some updates are async and we need to wait for them to complete, otherwise will we get a false positive.\n * (that the app will briefly be in the right state, but then update to an invalid state)\n */\n return Object.assign(result, {\n getPathname(this: RenderResult): string {\n return store.getRouteInfo().pathname;\n },\n getSegments(this: RenderResult): string[] {\n return store.getRouteInfo().segments;\n },\n getSearchParams(this: RenderResult): Record<string, string | string[]> {\n return store.getRouteInfo().params;\n },\n getPathnameWithParams(this: RenderResult): string {\n return store.getRouteInfo().pathnameWithParams;\n },\n getRouterState(this: RenderResult) {\n return store.state;\n },\n });\n}\n\nexport const testRouter = {\n /** Navigate to the provided pathname and the pathname */\n navigate(path: string) {\n rnTestingLibrary.act(() => router.navigate(path));\n expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);\n },\n /** Push the provided pathname and assert the pathname */\n push(path: string) {\n rnTestingLibrary.act(() => router.push(path));\n expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);\n },\n /** Replace with provided pathname and assert the pathname */\n replace(path: string) {\n rnTestingLibrary.act(() => router.replace(path));\n expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);\n },\n /** Go back in history and asset the new pathname */\n back(path?: string) {\n expect(router.canGoBack()).toBe(true);\n rnTestingLibrary.act(() => router.back());\n if (path) {\n expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);\n }\n },\n /** If there's history that supports invoking the `back` function. */\n canGoBack() {\n return router.canGoBack();\n },\n /** Update the current route query params and assert the new pathname */\n setParams(params: Record<string, string>, path?: string) {\n router.setParams(params);\n if (path) {\n expect(screen).toHavePathnameWithParams(path);\n }\n },\n /** If there's history that supports invoking the `back` function. */\n dismissAll() {\n rnTestingLibrary.act(() => router.dismissAll());\n },\n};\n"]}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/*
|
|
4
|
-
* Optionally enable @testing-library/jest-native/extend-expect. We use this internally for the `toBeOnTheScreen` matcher()
|
|
5
|
-
*/
|
|
6
|
-
try {
|
|
7
|
-
require('@testing-library/jest-native/extend-expect');
|
|
8
|
-
}
|
|
9
|
-
catch { }
|
|
10
3
|
try {
|
|
11
4
|
require('react-native-gesture-handler/jestSetup');
|
|
12
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../src/testing-library/mocks.ts"],"names":[],"mappings":";;AAAA
|
|
1
|
+
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../src/testing-library/mocks.ts"],"names":[],"mappings":";;AAAA,IAAI,CAAC;IACH,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACpD,CAAC;AAAC,MAAM,CAAC,CAAA,CAAC;AAEV,IAAI,CAAC;IACH,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACnC,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACxC,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;YAC3D,UAAU,CAAC,OAAO,CAAC,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,yCAAyC;YAC7E,OAAO,UAAU,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAAC,MAAM,CAAC,CAAA,CAAC;AAEV,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE;IAC7B,MAAM,MAAM,GAAkC;QAC5C,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC;QACrC,SAAS,CAAC,IAAY;YACpB,OAAO,eAAe,GAAG,IAAI,CAAC;QAChC,CAAC;QACD,aAAa;YACX,OAAO,YAAY,CAAC;QACtB,CAAC;QACD,gBAAgB;YACd,OAAO,EAAE,MAAM,KAAI,CAAC,EAAS,CAAC;QAChC,CAAC;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC","sourcesContent":["try {\n require('react-native-gesture-handler/jestSetup');\n} catch {}\n\ntry {\n require('react-native-reanimated');\n jest.mock('react-native-reanimated', () => {\n try {\n const Reanimated = require('react-native-reanimated/mock');\n Reanimated.default.call = () => {}; // Override `call` with a no-op if needed\n return Reanimated;\n } catch {\n return {};\n }\n });\n} catch {}\n\njest.mock('expo-linking', () => {\n const module: typeof import('expo-linking') = {\n ...jest.requireActual('expo-linking'),\n createURL(path: string) {\n return 'yourscheme://' + path;\n },\n resolveScheme() {\n return 'yourscheme';\n },\n addEventListener() {\n return { remove() {} } as any;\n },\n };\n\n return module;\n});\n"]}
|
|
@@ -2,6 +2,7 @@ import { RequireContext } from '../types';
|
|
|
2
2
|
export type GetTypedRoutesDeclarationFileOptions = {
|
|
3
3
|
partialTypedGroups?: boolean;
|
|
4
4
|
testIgnoreComments?: boolean;
|
|
5
|
+
unstable_useServerMiddleware?: boolean;
|
|
5
6
|
};
|
|
6
|
-
export declare function getTypedRoutesDeclarationFile(ctx: RequireContext, { partialTypedGroups, testIgnoreComments, }?: GetTypedRoutesDeclarationFileOptions): string;
|
|
7
|
+
export declare function getTypedRoutesDeclarationFile(ctx: RequireContext, { partialTypedGroups, testIgnoreComments, unstable_useServerMiddleware, }?: GetTypedRoutesDeclarationFileOptions): string;
|
|
7
8
|
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/typed-routes/generate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAW1C,MAAM,MAAM,oCAAoC,GAAG;IACjD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/typed-routes/generate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAW1C,MAAM,MAAM,oCAAoC,GAAG;IACjD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC,CAAC;AAEF,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,cAAc,EACnB,EACE,kBAA0B,EAC1B,kBAA0B,EAC1B,4BAAoC,GACrC,GAAE,oCAAyC,UA4G7C"}
|