expo-router 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/README.md +3 -0
  2. package/assets/file.png +0 -0
  3. package/assets/forward.png +0 -0
  4. package/assets/pkg.png +0 -0
  5. package/babel.js +77 -0
  6. package/build/ContextNavigationContainer.d.ts +33 -0
  7. package/build/ContextNavigationContainer.d.ts.map +1 -0
  8. package/build/ContextNavigationContainer.js +59 -0
  9. package/build/ContextNavigationContainer.js.map +1 -0
  10. package/build/ContextNavigator.d.ts +6 -0
  11. package/build/ContextNavigator.d.ts.map +1 -0
  12. package/build/ContextNavigator.js +52 -0
  13. package/build/ContextNavigator.js.map +1 -0
  14. package/build/Route.d.ts +34 -0
  15. package/build/Route.d.ts.map +1 -0
  16. package/build/Route.js +56 -0
  17. package/build/Route.js.map +1 -0
  18. package/build/aasa.d.ts +2 -0
  19. package/build/aasa.d.ts.map +1 -0
  20. package/build/aasa.js +25 -0
  21. package/build/aasa.js.map +1 -0
  22. package/build/context.d.ts +5 -0
  23. package/build/context.d.ts.map +1 -0
  24. package/build/context.js +14 -0
  25. package/build/context.js.map +1 -0
  26. package/build/fork/getPathFromState.d.ts +39 -0
  27. package/build/fork/getPathFromState.d.ts.map +1 -0
  28. package/build/fork/getPathFromState.js +209 -0
  29. package/build/fork/getPathFromState.js.map +1 -0
  30. package/build/fork/getStateFromPath.d.ts +33 -0
  31. package/build/fork/getStateFromPath.d.ts.map +1 -0
  32. package/build/fork/getStateFromPath.js +415 -0
  33. package/build/fork/getStateFromPath.js.map +1 -0
  34. package/build/getDevServer/index.d.ts +7 -0
  35. package/build/getDevServer/index.d.ts.map +1 -0
  36. package/build/getDevServer/index.js +30 -0
  37. package/build/getDevServer/index.js.map +1 -0
  38. package/build/getDevServer/index.native.d.ts +2 -0
  39. package/build/getDevServer/index.native.d.ts.map +1 -0
  40. package/build/getDevServer/index.native.js +2 -0
  41. package/build/getDevServer/index.native.js.map +1 -0
  42. package/build/getLinkingConfig.d.ts +5 -0
  43. package/build/getLinkingConfig.d.ts.map +1 -0
  44. package/build/getLinkingConfig.js +62 -0
  45. package/build/getLinkingConfig.js.map +1 -0
  46. package/build/getRoutes.d.ts +12 -0
  47. package/build/getRoutes.d.ts.map +1 -0
  48. package/build/getRoutes.js +165 -0
  49. package/build/getRoutes.js.map +1 -0
  50. package/build/index.d.ts +14 -0
  51. package/build/index.d.ts.map +1 -0
  52. package/build/index.js +13 -0
  53. package/build/index.js.map +1 -0
  54. package/build/layouts/Drawer.d.ts +132 -0
  55. package/build/layouts/Drawer.d.ts.map +1 -0
  56. package/build/layouts/Drawer.js +5 -0
  57. package/build/layouts/Drawer.js.map +1 -0
  58. package/build/layouts/NativeStack.d.ts +132 -0
  59. package/build/layouts/NativeStack.d.ts.map +1 -0
  60. package/build/layouts/NativeStack.js +5 -0
  61. package/build/layouts/NativeStack.js.map +1 -0
  62. package/build/layouts/Stack.d.ts +156 -0
  63. package/build/layouts/Stack.d.ts.map +1 -0
  64. package/build/layouts/Stack.js +6 -0
  65. package/build/layouts/Stack.js.map +1 -0
  66. package/build/layouts/Tabs.d.ts +136 -0
  67. package/build/layouts/Tabs.d.ts.map +1 -0
  68. package/build/layouts/Tabs.js +6 -0
  69. package/build/layouts/Tabs.js.map +1 -0
  70. package/build/layouts/withLayoutContext.d.ts +16 -0
  71. package/build/layouts/withLayoutContext.d.ts.map +1 -0
  72. package/build/layouts/withLayoutContext.js +73 -0
  73. package/build/layouts/withLayoutContext.js.map +1 -0
  74. package/build/matchers.d.ts +8 -0
  75. package/build/matchers.d.ts.map +1 -0
  76. package/build/matchers.js +25 -0
  77. package/build/matchers.js.map +1 -0
  78. package/build/onboard/Tutorial.d.ts +3 -0
  79. package/build/onboard/Tutorial.d.ts.map +1 -0
  80. package/build/onboard/Tutorial.js +129 -0
  81. package/build/onboard/Tutorial.js.map +1 -0
  82. package/build/onboard/createEntryFile.d.ts +3 -0
  83. package/build/onboard/createEntryFile.d.ts.map +1 -0
  84. package/build/onboard/createEntryFile.js +54 -0
  85. package/build/onboard/createEntryFile.js.map +1 -0
  86. package/build/primitives.d.ts +19 -0
  87. package/build/primitives.d.ts.map +1 -0
  88. package/build/primitives.js +5 -0
  89. package/build/primitives.js.map +1 -0
  90. package/build/types.d.ts +11 -0
  91. package/build/types.d.ts.map +1 -0
  92. package/build/types.js +2 -0
  93. package/build/types.js.map +1 -0
  94. package/build/useScreens.d.ts +10 -0
  95. package/build/useScreens.d.ts.map +1 -0
  96. package/build/useScreens.js +60 -0
  97. package/build/useScreens.js.map +1 -0
  98. package/build/views/Directory.d.ts +3 -0
  99. package/build/views/Directory.d.ts.map +1 -0
  100. package/build/views/Directory.js +142 -0
  101. package/build/views/Directory.js.map +1 -0
  102. package/build/views/ErrorBoundary.d.ts +4 -0
  103. package/build/views/ErrorBoundary.d.ts.map +1 -0
  104. package/build/views/ErrorBoundary.js +53 -0
  105. package/build/views/ErrorBoundary.js.map +1 -0
  106. package/build/views/Layout.d.ts +19 -0
  107. package/build/views/Layout.d.ts.map +1 -0
  108. package/build/views/Layout.js +48 -0
  109. package/build/views/Layout.js.map +1 -0
  110. package/build/views/Link.d.ts +26 -0
  111. package/build/views/Link.d.ts.map +1 -0
  112. package/build/views/Link.js +47 -0
  113. package/build/views/Link.js.map +1 -0
  114. package/build/views/Root.d.ts +6 -0
  115. package/build/views/Root.d.ts.map +1 -0
  116. package/build/views/Root.js +20 -0
  117. package/build/views/Root.js.map +1 -0
  118. package/build/views/Screen.d.ts +7 -0
  119. package/build/views/Screen.d.ts.map +1 -0
  120. package/build/views/Screen.js +19 -0
  121. package/build/views/Screen.js.map +1 -0
  122. package/build/views/Try.d.ts +24 -0
  123. package/build/views/Try.d.ts.map +1 -0
  124. package/build/views/Try.js +24 -0
  125. package/build/views/Try.js.map +1 -0
  126. package/build/views/Unmatched.d.ts +4 -0
  127. package/build/views/Unmatched.d.ts.map +1 -0
  128. package/build/views/Unmatched.js +46 -0
  129. package/build/views/Unmatched.js.map +1 -0
  130. package/entry.js +103 -0
  131. package/metro-config.js +14 -0
  132. package/package.json +62 -0
@@ -0,0 +1,156 @@
1
+ /// <reference types="react" />
2
+ import { StackNavigationOptions } from '@react-navigation/stack';
3
+ export declare const Stack: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/routers").DefaultRouterOptions<string> & {
4
+ id?: string | undefined;
5
+ children: import("react").ReactNode;
6
+ screenListeners?: Partial<{
7
+ transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionStart">;
8
+ transitionEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionEnd">;
9
+ gestureStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureStart">;
10
+ gestureEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureEnd">;
11
+ gestureCancel: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureCancel">;
12
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "focus">;
13
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "blur">;
14
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "state">;
15
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "beforeRemove">;
16
+ }> | ((props: {
17
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
18
+ navigation: any;
19
+ }) => Partial<{
20
+ transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionStart">;
21
+ transitionEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionEnd">;
22
+ gestureStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureStart">;
23
+ gestureEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureEnd">;
24
+ gestureCancel: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureCancel">;
25
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "focus">;
26
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "blur">;
27
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "state">;
28
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "beforeRemove">;
29
+ }>) | undefined;
30
+ screenOptions?: StackNavigationOptions | ((props: {
31
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
32
+ navigation: any;
33
+ }) => StackNavigationOptions) | undefined;
34
+ defaultScreenOptions?: StackNavigationOptions | ((props: {
35
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
36
+ navigation: any;
37
+ options: StackNavigationOptions;
38
+ }) => StackNavigationOptions) | undefined;
39
+ } & import("@react-navigation/routers").StackRouterOptions & import("@react-navigation/stack/lib/typescript/src/types").StackNavigationConfig, "children" | "initialRouteName" | "screenOptions" | "id" | "screenListeners" | "defaultScreenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
40
+ id?: string | undefined;
41
+ children: import("react").ReactNode;
42
+ screenListeners?: Partial<{
43
+ transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionStart">;
44
+ transitionEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionEnd">;
45
+ gestureStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureStart">;
46
+ gestureEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureEnd">;
47
+ gestureCancel: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureCancel">;
48
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "focus">;
49
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "blur">;
50
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "state">;
51
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "beforeRemove">;
52
+ }> | ((props: {
53
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
54
+ navigation: any;
55
+ }) => Partial<{
56
+ transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionStart">;
57
+ transitionEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionEnd">;
58
+ gestureStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureStart">;
59
+ gestureEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureEnd">;
60
+ gestureCancel: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureCancel">;
61
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "focus">;
62
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "blur">;
63
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "state">;
64
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "beforeRemove">;
65
+ }>) | undefined;
66
+ screenOptions?: StackNavigationOptions | ((props: {
67
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
68
+ navigation: any;
69
+ }) => StackNavigationOptions) | undefined;
70
+ defaultScreenOptions?: StackNavigationOptions | ((props: {
71
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
72
+ navigation: any;
73
+ options: StackNavigationOptions;
74
+ }) => StackNavigationOptions) | undefined;
75
+ }, "children"> & Partial<Pick<Omit<import("@react-navigation/routers").DefaultRouterOptions<string> & {
76
+ id?: string | undefined;
77
+ children: import("react").ReactNode;
78
+ screenListeners?: Partial<{
79
+ transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionStart">;
80
+ transitionEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionEnd">;
81
+ gestureStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureStart">;
82
+ gestureEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureEnd">;
83
+ gestureCancel: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureCancel">;
84
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "focus">;
85
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "blur">;
86
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "state">;
87
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "beforeRemove">;
88
+ }> | ((props: {
89
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
90
+ navigation: any;
91
+ }) => Partial<{
92
+ transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionStart">;
93
+ transitionEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionEnd">;
94
+ gestureStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureStart">;
95
+ gestureEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureEnd">;
96
+ gestureCancel: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureCancel">;
97
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "focus">;
98
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "blur">;
99
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "state">;
100
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "beforeRemove">;
101
+ }>) | undefined;
102
+ screenOptions?: StackNavigationOptions | ((props: {
103
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
104
+ navigation: any;
105
+ }) => StackNavigationOptions) | undefined;
106
+ defaultScreenOptions?: StackNavigationOptions | ((props: {
107
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
108
+ navigation: any;
109
+ options: StackNavigationOptions;
110
+ }) => StackNavigationOptions) | undefined;
111
+ } & import("@react-navigation/routers").StackRouterOptions & import("@react-navigation/stack/lib/typescript/src/types").StackNavigationConfig, "children" | "initialRouteName" | "screenOptions" | "id" | "screenListeners" | "defaultScreenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
112
+ id?: string | undefined;
113
+ children: import("react").ReactNode;
114
+ screenListeners?: Partial<{
115
+ transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionStart">;
116
+ transitionEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionEnd">;
117
+ gestureStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureStart">;
118
+ gestureEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureEnd">;
119
+ gestureCancel: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureCancel">;
120
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "focus">;
121
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "blur">;
122
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "state">;
123
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "beforeRemove">;
124
+ }> | ((props: {
125
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
126
+ navigation: any;
127
+ }) => Partial<{
128
+ transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionStart">;
129
+ transitionEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "transitionEnd">;
130
+ gestureStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureStart">;
131
+ gestureEnd: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureEnd">;
132
+ gestureCancel: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "gestureCancel">;
133
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "focus">;
134
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "blur">;
135
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "state">;
136
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap, "beforeRemove">;
137
+ }>) | undefined;
138
+ screenOptions?: StackNavigationOptions | ((props: {
139
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
140
+ navigation: any;
141
+ }) => StackNavigationOptions) | undefined;
142
+ defaultScreenOptions?: StackNavigationOptions | ((props: {
143
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
144
+ navigation: any;
145
+ options: StackNavigationOptions;
146
+ }) => StackNavigationOptions) | undefined;
147
+ }, "children">> & import("react").RefAttributes<unknown>> & {
148
+ Screen: (props: {
149
+ name?: string | undefined;
150
+ initialParams?: {
151
+ [key: string]: any;
152
+ } | undefined;
153
+ options?: StackNavigationOptions | undefined;
154
+ }) => null;
155
+ };
156
+ //# sourceMappingURL=Stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAwB,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAOvF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAmF,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { createStackNavigator } from '@react-navigation/stack';
2
+ import { withLayoutContext } from './withLayoutContext';
3
+ // This is the only way to access the navigator.
4
+ const StackNavigator = createStackNavigator().Navigator;
5
+ export const Stack = withLayoutContext(StackNavigator);
6
+ //# sourceMappingURL=Stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA0B,MAAM,yBAAyB,CAAC;AAEvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,gDAAgD;AAChD,MAAM,cAAc,GAAG,oBAAoB,EAAE,CAAC,SAAS,CAAC;AAExD,MAAM,CAAC,MAAM,KAAK,GAAG,iBAAiB,CAAgD,cAAc,CAAC,CAAC","sourcesContent":["import { createStackNavigator, StackNavigationOptions } from '@react-navigation/stack';\n\nimport { withLayoutContext } from './withLayoutContext';\n\n// This is the only way to access the navigator.\nconst StackNavigator = createStackNavigator().Navigator;\n\nexport const Stack = withLayoutContext<StackNavigationOptions, typeof StackNavigator>(StackNavigator);\n"]}
@@ -0,0 +1,136 @@
1
+ /// <reference types="react" />
2
+ import { BottomTabNavigationOptions } from '@react-navigation/bottom-tabs';
3
+ export declare const Tabs: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/routers").DefaultRouterOptions<string> & {
4
+ id?: string | undefined;
5
+ children: import("react").ReactNode;
6
+ screenListeners?: Partial<{
7
+ tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
8
+ tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
9
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "focus">;
10
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "blur">;
11
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "state">;
12
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "beforeRemove">;
13
+ }> | ((props: {
14
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
15
+ navigation: any;
16
+ }) => Partial<{
17
+ tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
18
+ tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
19
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "focus">;
20
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "blur">;
21
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "state">;
22
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "beforeRemove">;
23
+ }>) | undefined;
24
+ screenOptions?: BottomTabNavigationOptions | ((props: {
25
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
26
+ navigation: any;
27
+ }) => BottomTabNavigationOptions) | undefined;
28
+ defaultScreenOptions?: BottomTabNavigationOptions | ((props: {
29
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
30
+ navigation: any;
31
+ options: BottomTabNavigationOptions;
32
+ }) => BottomTabNavigationOptions) | undefined;
33
+ } & {
34
+ backBehavior?: import("@react-navigation/routers/lib/typescript/src/TabRouter").BackBehavior | undefined;
35
+ } & import("@react-navigation/bottom-tabs/lib/typescript/src/types").BottomTabNavigationConfig, "children" | "initialRouteName" | "screenOptions" | "id" | "screenListeners" | "defaultScreenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
36
+ id?: string | undefined;
37
+ children: import("react").ReactNode;
38
+ screenListeners?: Partial<{
39
+ tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
40
+ tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
41
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "focus">;
42
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "blur">;
43
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "state">;
44
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "beforeRemove">;
45
+ }> | ((props: {
46
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
47
+ navigation: any;
48
+ }) => Partial<{
49
+ tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
50
+ tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
51
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "focus">;
52
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "blur">;
53
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "state">;
54
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "beforeRemove">;
55
+ }>) | undefined;
56
+ screenOptions?: BottomTabNavigationOptions | ((props: {
57
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
58
+ navigation: any;
59
+ }) => BottomTabNavigationOptions) | undefined;
60
+ defaultScreenOptions?: BottomTabNavigationOptions | ((props: {
61
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
62
+ navigation: any;
63
+ options: BottomTabNavigationOptions;
64
+ }) => BottomTabNavigationOptions) | undefined;
65
+ }, "children"> & Partial<Pick<Omit<import("@react-navigation/routers").DefaultRouterOptions<string> & {
66
+ id?: string | undefined;
67
+ children: import("react").ReactNode;
68
+ screenListeners?: Partial<{
69
+ tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
70
+ tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
71
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "focus">;
72
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "blur">;
73
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "state">;
74
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "beforeRemove">;
75
+ }> | ((props: {
76
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
77
+ navigation: any;
78
+ }) => Partial<{
79
+ tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
80
+ tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
81
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "focus">;
82
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "blur">;
83
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "state">;
84
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "beforeRemove">;
85
+ }>) | undefined;
86
+ screenOptions?: BottomTabNavigationOptions | ((props: {
87
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
88
+ navigation: any;
89
+ }) => BottomTabNavigationOptions) | undefined;
90
+ defaultScreenOptions?: BottomTabNavigationOptions | ((props: {
91
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
92
+ navigation: any;
93
+ options: BottomTabNavigationOptions;
94
+ }) => BottomTabNavigationOptions) | undefined;
95
+ } & {
96
+ backBehavior?: import("@react-navigation/routers/lib/typescript/src/TabRouter").BackBehavior | undefined;
97
+ } & import("@react-navigation/bottom-tabs/lib/typescript/src/types").BottomTabNavigationConfig, "children" | "initialRouteName" | "screenOptions" | "id" | "screenListeners" | "defaultScreenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
98
+ id?: string | undefined;
99
+ children: import("react").ReactNode;
100
+ screenListeners?: Partial<{
101
+ tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
102
+ tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
103
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "focus">;
104
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "blur">;
105
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "state">;
106
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "beforeRemove">;
107
+ }> | ((props: {
108
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
109
+ navigation: any;
110
+ }) => Partial<{
111
+ tabPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabPress">;
112
+ tabLongPress: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "tabLongPress">;
113
+ focus: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "focus">;
114
+ blur: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "blur">;
115
+ state: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "state">;
116
+ beforeRemove: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/bottom-tabs").BottomTabNavigationEventMap, "beforeRemove">;
117
+ }>) | undefined;
118
+ screenOptions?: BottomTabNavigationOptions | ((props: {
119
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
120
+ navigation: any;
121
+ }) => BottomTabNavigationOptions) | undefined;
122
+ defaultScreenOptions?: BottomTabNavigationOptions | ((props: {
123
+ route: import("@react-navigation/core").RouteProp<import("@react-navigation/routers").ParamListBase, string>;
124
+ navigation: any;
125
+ options: BottomTabNavigationOptions;
126
+ }) => BottomTabNavigationOptions) | undefined;
127
+ }, "children">> & import("react").RefAttributes<unknown>> & {
128
+ Screen: (props: {
129
+ name?: string | undefined;
130
+ initialParams?: {
131
+ [key: string]: any;
132
+ } | undefined;
133
+ options?: BottomTabNavigationOptions | undefined;
134
+ }) => null;
135
+ };
136
+ //# sourceMappingURL=Tabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,0BAA0B,EAA4B,MAAM,+BAA+B,CAAC;AAOrG,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAA+F,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
2
+ import { withLayoutContext } from './withLayoutContext';
3
+ // This is the only way to access the navigator.
4
+ const BottomTabNavigator = createBottomTabNavigator().Navigator;
5
+ export const Tabs = withLayoutContext(BottomTabNavigator);
6
+ //# sourceMappingURL=Tabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8B,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAErG,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,gDAAgD;AAChD,MAAM,kBAAkB,GAAG,wBAAwB,EAAE,CAAC,SAAS,CAAC;AAEhE,MAAM,CAAC,MAAM,IAAI,GAAG,iBAAiB,CAAwD,kBAAkB,CAAC,CAAC","sourcesContent":["import { BottomTabNavigationOptions, createBottomTabNavigator } from '@react-navigation/bottom-tabs';\n\nimport { withLayoutContext } from './withLayoutContext';\n\n// This is the only way to access the navigator.\nconst BottomTabNavigator = createBottomTabNavigator().Navigator;\n\nexport const Tabs = withLayoutContext<BottomTabNavigationOptions, typeof BottomTabNavigator>(BottomTabNavigator);\n"]}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ declare type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
3
+ declare type ScreenProps<TOptions extends Record<string, any> = Record<string, any>> = {
4
+ /** Name is required when used inside a Layout component. */
5
+ name?: string;
6
+ initialParams?: {
7
+ [key: string]: any;
8
+ };
9
+ options?: TOptions;
10
+ };
11
+ /** Return a navigator that automatically injects matched routes and renders nothing when there are no children. Return type with children prop optional */
12
+ export declare function withLayoutContext<TOptions extends {}, T extends React.ComponentType<any>>(Nav: T): (React.ForwardRefExoticComponent<React.PropsWithoutRef<PickPartial<React.ComponentProps<T>, "children">> & React.RefAttributes<unknown>>) & {
13
+ Screen: (props: ScreenProps<TOptions>) => null;
14
+ };
15
+ export {};
16
+ //# sourceMappingURL=withLayoutContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withLayoutContext.d.ts","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,aAAK,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAExB,aAAK,WAAW,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;IAC3E,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACvC,OAAO,CAAC,EAAE,QAAQ,CAAC;CACtB,CAAA;AA+BD,2JAA2J;AAC3J,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EACrF,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;IACjJ,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAA;CACjD,CAiDJ"}
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import { useScreensRecord } from '../useScreens';
3
+ import { Screen } from '../views/Screen';
4
+ function useSortedChildren(children, order) {
5
+ return React.useMemo(() => {
6
+ if (!order?.length) {
7
+ return Object.values(children);
8
+ }
9
+ const entries = Object.entries(children);
10
+ const ordered = order.map(({ name, initialParams, options }) => {
11
+ const matchIndex = entries.findIndex((child) => child[0] === name);
12
+ if (matchIndex === -1) {
13
+ console.warn(`[Layout children]: No route named "${name}" exists in nested children:`, Object.keys(children));
14
+ return null;
15
+ }
16
+ else {
17
+ // Get match and remove from entries
18
+ const [, match] = entries[matchIndex];
19
+ entries.splice(matchIndex, 1);
20
+ // @ts-expect-error
21
+ return React.cloneElement(match, { initialParams, options });
22
+ }
23
+ }).filter(Boolean);
24
+ // Add any remaining children
25
+ // @ts-expect-error
26
+ ordered.push(...entries.map(([, child]) => child));
27
+ return ordered;
28
+ }, [children, order]);
29
+ }
30
+ /** Return a navigator that automatically injects matched routes and renders nothing when there are no children. Return type with children prop optional */
31
+ export function withLayoutContext(Nav) {
32
+ const Navigator = React.forwardRef(({ children: userDefinedChildren, ...props }, ref) => {
33
+ const userDefinedOptions = React.useMemo(() => {
34
+ const screens = React.Children.map(userDefinedChildren, (child) => {
35
+ if (React.isValidElement(child) && child && child.type === Screen) {
36
+ if (!child.props.name) {
37
+ throw new Error('Screen must have a name prop when used as a child of a Layout');
38
+ }
39
+ if (process.env.NODE_ENV !== 'production') {
40
+ if (['children', 'component', 'getComponent'].some((key) => key in child.props)) {
41
+ throw new Error('Screen must not have a children, component, or getComponent prop when used as a child of a Layout');
42
+ }
43
+ }
44
+ return child.props;
45
+ }
46
+ else {
47
+ console.warn('Layout children must be of type Screen, all other children are ignored. To use custom children, create a custom <Layout />.');
48
+ }
49
+ });
50
+ if (process.env.NODE_ENV !== 'production') {
51
+ // Assert if names are not unique
52
+ const names = screens?.map((screen) => screen.name);
53
+ if (names && new Set(names).size !== names.length) {
54
+ throw new Error('Screen names must be unique: ' + names);
55
+ }
56
+ }
57
+ return screens;
58
+ }, [userDefinedChildren]);
59
+ const children = useScreensRecord();
60
+ const sorted = useSortedChildren(children, userDefinedOptions);
61
+ // Prevent throwing an error when there are no screens.
62
+ if (!sorted.length) {
63
+ return null;
64
+ }
65
+ // @ts-expect-error
66
+ return React.createElement(Nav, { ...props, ref: ref, children: sorted });
67
+ });
68
+ // @ts-expect-error
69
+ Navigator.Screen = Screen;
70
+ // @ts-expect-error
71
+ return Navigator;
72
+ }
73
+ //# sourceMappingURL=withLayoutContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withLayoutContext.js","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":"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","sourcesContent":["import React from 'react';\n\nimport { useScreensRecord } from '../useScreens';\nimport { Screen } from '../views/Screen';\n\ntype PickPartial<T, K extends keyof T> = Omit<T, K> &\n Partial<Pick<T, K>>;\n\ntype ScreenProps<TOptions extends Record<string, any> = Record<string, any>> = {\n /** Name is required when used inside a Layout component. */\n name?: string,\n initialParams?: { [key: string]: any };\n options?: TOptions;\n}\n\nfunction useSortedChildren(children: Record<string, React.ReactNode>, order?: ScreenProps[]): React.ReactNode[] {\n return React.useMemo(() => {\n if (!order?.length) {\n return Object.values(children);\n }\n const entries = Object.entries(children);\n\n const ordered = order.map(({ name, initialParams, options }) => {\n const matchIndex = entries.findIndex((child) => child[0] === name)\n if (matchIndex === -1) {\n console.warn(`[Layout children]: No route named \"${name}\" exists in nested children:`, Object.keys(children));\n return null;\n } else {\n // Get match and remove from entries\n const [, match] = entries[matchIndex];\n entries.splice(matchIndex, 1);\n // @ts-expect-error\n return React.cloneElement(match, { initialParams, options });\n }\n }).filter(Boolean)\n\n // Add any remaining children\n // @ts-expect-error\n ordered.push(...entries.map(([, child]) => child));\n\n return ordered;\n }, [children, order]);\n}\n\n/** Return a navigator that automatically injects matched routes and renders nothing when there are no children. Return type with children prop optional */\nexport function withLayoutContext<TOptions extends {}, T extends React.ComponentType<any>>(\n Nav: T): (React.ForwardRefExoticComponent<React.PropsWithoutRef<PickPartial<React.ComponentProps<T>, \"children\">> & React.RefAttributes<unknown>>) & {\n Screen: (props: ScreenProps<TOptions>) => null\n } {\n\n\n const Navigator = React.forwardRef(({ children: userDefinedChildren, ...props }: PickPartial<React.ComponentProps<T>, 'children'>, ref) => {\n const userDefinedOptions = React.useMemo(() => {\n const screens = React.Children.map(userDefinedChildren, (child) => {\n if (React.isValidElement(child) && child && child.type === Screen) {\n if (!child.props.name) {\n throw new Error('Screen must have a name prop when used as a child of a Layout');\n }\n if (process.env.NODE_ENV !== 'production') {\n if (['children', 'component', 'getComponent'].some((key) => key in child.props)) {\n throw new Error('Screen must not have a children, component, or getComponent prop when used as a child of a Layout');\n }\n }\n return child.props;\n } else {\n console.warn('Layout children must be of type Screen, all other children are ignored. To use custom children, create a custom <Layout />.');\n }\n })\n\n if (process.env.NODE_ENV !== 'production') {\n // Assert if names are not unique\n const names = screens?.map((screen) => screen.name);\n if (names && new Set(names).size !== names.length) {\n throw new Error('Screen names must be unique: ' + names);\n }\n }\n\n return screens;\n }, [userDefinedChildren]);\n\n const children = useScreensRecord();\n\n const sorted = useSortedChildren(children, userDefinedOptions);\n\n // Prevent throwing an error when there are no screens.\n if (!sorted.length) {\n return null;\n }\n\n // @ts-expect-error\n return <Nav {...props} ref={ref} children={sorted} />;\n });\n\n // @ts-expect-error\n Navigator.Screen = Screen;\n // @ts-expect-error\n return Navigator;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /** Match `[page]` -> `page` */
2
+ export declare function matchDynamicName(name: string): string | undefined;
3
+ /** Match `[...page]` -> `page` */
4
+ export declare function matchDeepDynamicRouteName(name: string): string | undefined;
5
+ /** Match `(page)` -> `page` */
6
+ export declare function matchFragmentName(name: string): string | undefined;
7
+ export declare function getNameFromFilePath(name: string): string;
8
+ //# sourceMappingURL=matchers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matchers.d.ts","sourceRoot":"","sources":["../src/matchers.tsx"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGjE;AAED,kCAAkC;AAClC,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE1E;AAED,+BAA+B;AAC/B,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAElE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD"}
@@ -0,0 +1,25 @@
1
+ /** Match `[page]` -> `page` */
2
+ export function matchDynamicName(name) {
3
+ // Don't match `...` or `[` or `]` inside the brackets
4
+ return name.match(/^\[([^/\[\](?:\.\.\.)]+?)\]$/)?.[1];
5
+ }
6
+ /** Match `[...page]` -> `page` */
7
+ export function matchDeepDynamicRouteName(name) {
8
+ return name.match(/^\[\.\.\.([^/]+?)\]$/)?.[1];
9
+ }
10
+ /** Match `(page)` -> `page` */
11
+ export function matchFragmentName(name) {
12
+ return name.match(/^\(([^/]+?)\)$/)?.[1];
13
+ }
14
+ export function getNameFromFilePath(name) {
15
+ return removeSupportedExtensions(removeFileSystemDots(name));
16
+ }
17
+ /** Remove `.js`, `.ts`, `.jsx`, `.tsx` */
18
+ function removeSupportedExtensions(name) {
19
+ return name.replace(/\.[jt]sx?$/g, "");
20
+ }
21
+ // Remove any amount of `./` and `../` from the start of the string
22
+ function removeFileSystemDots(filePath) {
23
+ return filePath.replace(/^(?:\.\.?\/)+/g, "");
24
+ }
25
+ //# sourceMappingURL=matchers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matchers.js","sourceRoot":"","sources":["../src/matchers.tsx"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,MAAM,UAAU,gBAAgB,CAAC,IAAY;IACzC,sDAAsD;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,kCAAkC;AAClC,MAAM,UAAU,yBAAyB,CAAC,IAAY;IAClD,OAAO,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,+BAA+B;AAC/B,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC5C,OAAO,yBAAyB,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC;AAED,0CAA0C;AAC1C,SAAS,yBAAyB,CAAC,IAAY;IAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,mEAAmE;AACnE,SAAS,oBAAoB,CAAC,QAAgB;IAC1C,OAAO,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC","sourcesContent":["/** Match `[page]` -> `page` */\nexport function matchDynamicName(name: string): string | undefined {\n // Don't match `...` or `[` or `]` inside the brackets\n return name.match(/^\\[([^/\\[\\](?:\\.\\.\\.)]+?)\\]$/)?.[1];\n}\n\n/** Match `[...page]` -> `page` */\nexport function matchDeepDynamicRouteName(name: string): string | undefined {\n return name.match(/^\\[\\.\\.\\.([^/]+?)\\]$/)?.[1];\n}\n\n/** Match `(page)` -> `page` */\nexport function matchFragmentName(name: string): string | undefined {\n return name.match(/^\\(([^/]+?)\\)$/)?.[1];\n}\n\nexport function getNameFromFilePath(name: string): string {\n return removeSupportedExtensions(removeFileSystemDots(name));\n}\n\n/** Remove `.js`, `.ts`, `.jsx`, `.tsx` */\nfunction removeSupportedExtensions(name: string): string {\n return name.replace(/\\.[jt]sx?$/g, \"\");\n}\n\n// Remove any amount of `./` and `../` from the start of the string\nfunction removeFileSystemDots(filePath: string): string {\n return filePath.replace(/^(?:\\.\\.?\\/)+/g, \"\");\n}\n"]}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare function Tutorial(): JSX.Element;
3
+ //# sourceMappingURL=Tutorial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tutorial.d.ts","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":";AAgCA,wBAAgB,QAAQ,gBAoDvB"}