@mapples/app 1.0.2 → 1.1.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.
- package/README.md +44 -18
- package/dist/MapplesApp.d.ts +4 -0
- package/dist/MapplesApp.d.ts.map +1 -1
- package/dist/MapplesApp.js +9 -2
- package/dist/MapplesApp.js.map +1 -1
- package/dist/MapplesAppProvider.d.ts +6 -2
- package/dist/MapplesAppProvider.d.ts.map +1 -1
- package/dist/MapplesAppProvider.js +6 -2
- package/dist/MapplesAppProvider.js.map +1 -1
- package/dist/NavigationContext.d.ts +37 -0
- package/dist/NavigationContext.d.ts.map +1 -0
- package/dist/NavigationContext.js +21 -0
- package/dist/NavigationContext.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/navigationDispatch.d.ts +26 -0
- package/dist/navigationDispatch.d.ts.map +1 -0
- package/dist/navigationDispatch.js +39 -0
- package/dist/navigationDispatch.js.map +1 -0
- package/dist/useNavigationActions.d.ts +19 -0
- package/dist/useNavigationActions.d.ts.map +1 -0
- package/dist/useNavigationActions.js +26 -0
- package/dist/useNavigationActions.js.map +1 -0
- package/expo/index.js +11 -0
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -31,11 +31,7 @@ import React from 'react';
|
|
|
31
31
|
import MapplesApp from '@mapples/app';
|
|
32
32
|
|
|
33
33
|
function App() {
|
|
34
|
-
return
|
|
35
|
-
<MapplesApp>
|
|
36
|
-
{/* Your app components */}
|
|
37
|
-
</MapplesApp>
|
|
38
|
-
);
|
|
34
|
+
return <MapplesApp>{/* Your app components */}</MapplesApp>;
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
export default App;
|
|
@@ -78,10 +74,7 @@ const customStyle = {
|
|
|
78
74
|
|
|
79
75
|
function App() {
|
|
80
76
|
return (
|
|
81
|
-
<MapplesApp
|
|
82
|
-
assets={customAssets}
|
|
83
|
-
style={customStyle}
|
|
84
|
-
>
|
|
77
|
+
<MapplesApp assets={customAssets} style={customStyle}>
|
|
85
78
|
{/* Your app components */}
|
|
86
79
|
</MapplesApp>
|
|
87
80
|
);
|
|
@@ -92,15 +85,16 @@ export default App;
|
|
|
92
85
|
|
|
93
86
|
## API Reference
|
|
94
87
|
|
|
95
|
-
### MapplesApp
|
|
88
|
+
### MapplesApp
|
|
96
89
|
|
|
97
|
-
The main component that provides the core Mapples ecosystem functionality.
|
|
90
|
+
The main component that provides the core Mapples ecosystem functionality.
|
|
98
91
|
|
|
99
92
|
**Props:**
|
|
100
93
|
|
|
101
94
|
- `children` - Child components
|
|
102
95
|
- `style?` - Optional custom style configuration to override the default Mapples styling
|
|
103
96
|
- `assets?` - Optional custom assets configuration to override the default Mapples assets
|
|
97
|
+
- `navigation?` - Optional `NavigationMap` (Mapples action `routeName` → expo-router href) consumed by `useNavigationActions`
|
|
104
98
|
- `showFontLoadingIndicator?` - Whether to show a loading indicator while fonts are loading
|
|
105
99
|
- `FontLoadingIndicator?` - Custom loading indicator component to display while fonts are loading
|
|
106
100
|
|
|
@@ -115,16 +109,48 @@ The main component that provides the core Mapples ecosystem functionality. It wr
|
|
|
115
109
|
</MapplesApp>
|
|
116
110
|
```
|
|
117
111
|
|
|
118
|
-
###
|
|
112
|
+
### Navigation
|
|
113
|
+
|
|
114
|
+
`@mapples/app` bridges Mapples **navigation** actions (`mapples:navigate`,
|
|
115
|
+
`mapples:switchTab`, `mapples:goBack`, `mapples:openDrawer`,
|
|
116
|
+
`mapples:closeDrawer`) to [expo-router](https://docs.expo.dev/router/introduction/).
|
|
119
117
|
|
|
120
|
-
|
|
118
|
+
Pass the generated `NavigationMap` (default-exported from the
|
|
119
|
+
`mapples navigation sync`–generated `navigationMap.ts`) into `MapplesApp` via the
|
|
120
|
+
`navigation` prop, mirroring `assets` and `style`:
|
|
121
121
|
|
|
122
122
|
```tsx
|
|
123
|
-
import MapplesApp
|
|
123
|
+
import MapplesApp from '@mapples/app';
|
|
124
|
+
import navigationMap from '../navigation/navigationMap';
|
|
124
125
|
|
|
125
|
-
|
|
126
|
-
<
|
|
127
|
-
|
|
126
|
+
<MapplesApp style={style} assets={assets} navigation={navigationMap}>
|
|
127
|
+
<YourAppContent />
|
|
128
|
+
</MapplesApp>;
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Generated route wrappers consume it through `useNavigationActions`, composing the
|
|
132
|
+
result into the Mapplet's `onAction` for the navigation subset:
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
import { useNavigationActions } from '@mapples/app';
|
|
136
|
+
|
|
137
|
+
const onNavigation = useNavigationActions();
|
|
138
|
+
// onNavigation(action) → router.push / router.back / OPEN_DRAWER / CLOSE_DRAWER
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`useNavigationActions` reads the `NavigationMap` from context and dispatches via
|
|
142
|
+
expo-router's `useRouter` + `useNavigation`. Unknown action types and unmapped
|
|
143
|
+
`routeName`s are no-ops.
|
|
144
|
+
|
|
145
|
+
#### Peer dependency: `expo-router`
|
|
146
|
+
|
|
147
|
+
`useNavigationActions` depends on `expo-router`, declared as an **optional peer
|
|
148
|
+
dependency**. Apps that use Mapples navigation already depend on `expo-router`;
|
|
149
|
+
non-navigation apps are not forced to install it because the hook is only ever
|
|
150
|
+
imported from generated route wrappers (which render inside the router context).
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
yarn add expo-router # only if your app uses Mapples navigation
|
|
128
154
|
```
|
|
129
155
|
|
|
130
156
|
### Utility Functions
|
|
@@ -358,4 +384,4 @@ MIT License - see LICENSE file for details.
|
|
|
358
384
|
|
|
359
385
|
## Author
|
|
360
386
|
|
|
361
|
-
Oleksandr Soloviov - [mapples.org](https://mapples.org/people/olek_soloviov)
|
|
387
|
+
Oleksandr Soloviov - [mapples.org](https://mapples.org/people/olek_soloviov)
|
package/dist/MapplesApp.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FC, PropsWithChildren, JSX } from 'react';
|
|
2
2
|
import { AnyObject } from '@mapples/render';
|
|
3
3
|
import { StyleContextType } from '@mapples/style';
|
|
4
|
+
import { NavigationMap } from './NavigationContext';
|
|
4
5
|
/**
|
|
5
6
|
* Props for the MapplesApp component.
|
|
6
7
|
*
|
|
@@ -11,6 +12,8 @@ export interface MapplesAppProps {
|
|
|
11
12
|
style?: StyleContextType;
|
|
12
13
|
/** Optional custom assets configuration to override the default Mapples assets */
|
|
13
14
|
assets?: AnyObject;
|
|
15
|
+
/** Optional navigation map (Mapples action `routeName` → expo-router href) for navigation actions */
|
|
16
|
+
navigation?: NavigationMap;
|
|
14
17
|
/** Whether to show a loading indicator while fonts are loading */
|
|
15
18
|
showFontLoadingIndicator?: boolean;
|
|
16
19
|
/** Custom loading indicator component to display while fonts are loading */
|
|
@@ -25,6 +28,7 @@ export interface MapplesAppProps {
|
|
|
25
28
|
*
|
|
26
29
|
* @component
|
|
27
30
|
* @param props - The component props
|
|
31
|
+
* @param props.children - The application content to render inside the Mapples providers
|
|
28
32
|
* @returns The configured Mapples app with all necessary providers
|
|
29
33
|
*
|
|
30
34
|
* @example
|
package/dist/MapplesApp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapplesApp.d.ts","sourceRoot":"","sources":["../src/MapplesApp.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"MapplesApp.d.ts","sourceRoot":"","sources":["../src/MapplesApp.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,gBAAgB,CAAC;AAazE,OAAO,EAAE,aAAa,EAAsB,MAAM,qBAAqB,CAAC;AAGxE;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,kFAAkF;IAClF,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,qGAAqG;IACrG,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,kEAAkE;IAClE,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,4EAA4E;IAC5E,oBAAoB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CA0BtD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/MapplesApp.js
CHANGED
|
@@ -8,7 +8,11 @@ import { useFonts } from 'expo-font';
|
|
|
8
8
|
import assetsConfig from 'mapples::assets';
|
|
9
9
|
// @ts-ignore
|
|
10
10
|
// eslint-disable-next-line import/no-unresolved
|
|
11
|
+
import navigationConfig from 'mapples::navigation';
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
// eslint-disable-next-line import/no-unresolved
|
|
11
14
|
import styleConfig from 'mapples::style';
|
|
15
|
+
import { NavigationProvider } from './NavigationContext';
|
|
12
16
|
import { remapFonts } from './utils';
|
|
13
17
|
/**
|
|
14
18
|
* The main MapplesApp component that provides the core Mapples ecosystem functionality.
|
|
@@ -19,6 +23,7 @@ import { remapFonts } from './utils';
|
|
|
19
23
|
*
|
|
20
24
|
* @component
|
|
21
25
|
* @param props - The component props
|
|
26
|
+
* @param props.children - The application content to render inside the Mapples providers
|
|
22
27
|
* @returns The configured Mapples app with all necessary providers
|
|
23
28
|
*
|
|
24
29
|
* @example
|
|
@@ -50,14 +55,16 @@ import { remapFonts } from './utils';
|
|
|
50
55
|
* }
|
|
51
56
|
* ```
|
|
52
57
|
*/
|
|
53
|
-
const MapplesApp = ({ children, style, assets, showFontLoadingIndicator, FontLoadingIndicator, }) => {
|
|
58
|
+
const MapplesApp = ({ children, style, assets, navigation, showFontLoadingIndicator, FontLoadingIndicator, }) => {
|
|
54
59
|
const [loaded] = useFonts(remapFonts(assets || assetsConfig));
|
|
55
60
|
if (!loaded && showFontLoadingIndicator) {
|
|
56
61
|
return FontLoadingIndicator || null;
|
|
57
62
|
}
|
|
58
63
|
return (<StyleProvider style={Styler.init(style || styleConfig)}>
|
|
59
64
|
<RenderProvider components={{ ...Components, ...UIComponents }} assets={assets || assetsConfig}>
|
|
60
|
-
{
|
|
65
|
+
<NavigationProvider navigation={navigation || navigationConfig}>
|
|
66
|
+
{children}
|
|
67
|
+
</NavigationProvider>
|
|
61
68
|
</RenderProvider>
|
|
62
69
|
</StyleProvider>);
|
|
63
70
|
};
|
package/dist/MapplesApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapplesApp.js","sourceRoot":"","sources":["../src/MapplesApp.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAa,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAoB,aAAa,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,aAAa;AACb,gDAAgD;AAChD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,aAAa;AACb,gDAAgD;AAChD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"MapplesApp.js","sourceRoot":"","sources":["../src/MapplesApp.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAa,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAoB,aAAa,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,aAAa;AACb,gDAAgD;AAChD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,aAAa;AACb,gDAAgD;AAChD,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,aAAa;AACb,gDAAgD;AAChD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAiB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAoBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,GAA2C,CAAC,EAC1D,QAAQ,EACR,KAAK,EACL,MAAM,EACN,UAAU,EACV,wBAAwB,EACxB,oBAAoB,GACrB,EAAE,EAAE;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC;IAE9D,IAAI,CAAC,MAAM,IAAI,wBAAwB,EAAE,CAAC;QACxC,OAAO,oBAAoB,IAAI,IAAI,CAAC;IACtC,CAAC;IAED,OAAO,CACL,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,WAAW,CAAC,CAAC,CACtD;MAAA,CAAC,cAAc,CACb,UAAU,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,YAAY,EAAE,CAAC,CAC/C,MAAM,CAAC,CAAC,MAAM,IAAI,YAAY,CAAC,CAE/B;QAAA,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,UAAU,IAAI,gBAAgB,CAAC,CAC7D;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,kBAAkB,CACtB;MAAA,EAAE,cAAc,CAClB;IAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { FC, PropsWithChildren, JSX } from 'react';
|
|
2
2
|
import { AnyObject } from '@mapples/render';
|
|
3
3
|
import { StyleContextType } from '@mapples/style';
|
|
4
|
+
import { NavigationMap } from './NavigationContext';
|
|
4
5
|
/**
|
|
5
6
|
* Props for the MapplesApp component.
|
|
6
7
|
*
|
|
7
8
|
* @interface MapplesAppProps
|
|
8
9
|
*/
|
|
9
10
|
export interface MapplesAppProps {
|
|
10
|
-
/**
|
|
11
|
+
/** The style configuration for the Mapples styling system */
|
|
11
12
|
style: StyleContextType;
|
|
12
|
-
/**
|
|
13
|
+
/** The assets configuration object containing font and image references */
|
|
13
14
|
assets: AnyObject;
|
|
15
|
+
/** Optional navigation map (Mapples action `routeName` → expo-router href) for navigation actions */
|
|
16
|
+
navigation?: NavigationMap;
|
|
14
17
|
/** Whether to show a loading indicator while fonts are loading */
|
|
15
18
|
showFontLoadingIndicator?: boolean;
|
|
16
19
|
/** Custom loading indicator component to display while fonts are loading */
|
|
@@ -25,6 +28,7 @@ export interface MapplesAppProps {
|
|
|
25
28
|
*
|
|
26
29
|
* @component
|
|
27
30
|
* @param props - The component props
|
|
31
|
+
* @param props.children - The application content to render inside the Mapples providers
|
|
28
32
|
* @returns The configured Mapples app with all necessary providers
|
|
29
33
|
*
|
|
30
34
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapplesAppProvider.d.ts","sourceRoot":"","sources":["../src/MapplesAppProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"MapplesAppProvider.d.ts","sourceRoot":"","sources":["../src/MapplesAppProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,gBAAgB,CAAC;AAIzE,OAAO,EAAE,aAAa,EAAsB,MAAM,qBAAqB,CAAC;AAGxE;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,KAAK,EAAE,gBAAgB,CAAC;IACxB,2EAA2E;IAC3E,MAAM,EAAE,SAAS,CAAC;IAClB,qGAAqG;IACrG,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,kEAAkE;IAClE,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,4EAA4E;IAC5E,oBAAoB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CA0BtD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { RenderProvider } from '@mapples/render';
|
|
|
3
3
|
import { StyleProvider, Styler } from '@mapples/style';
|
|
4
4
|
import { UIComponents } from '@mapples/ui';
|
|
5
5
|
import { useFonts } from 'expo-font';
|
|
6
|
+
import { NavigationProvider } from './NavigationContext';
|
|
6
7
|
import { remapFonts } from './utils';
|
|
7
8
|
/**
|
|
8
9
|
* The main MapplesApp component that provides the core Mapples ecosystem functionality.
|
|
@@ -13,6 +14,7 @@ import { remapFonts } from './utils';
|
|
|
13
14
|
*
|
|
14
15
|
* @component
|
|
15
16
|
* @param props - The component props
|
|
17
|
+
* @param props.children - The application content to render inside the Mapples providers
|
|
16
18
|
* @returns The configured Mapples app with all necessary providers
|
|
17
19
|
*
|
|
18
20
|
* @example
|
|
@@ -44,14 +46,16 @@ import { remapFonts } from './utils';
|
|
|
44
46
|
* }
|
|
45
47
|
* ```
|
|
46
48
|
*/
|
|
47
|
-
const MapplesApp = ({ children, style, assets, showFontLoadingIndicator, FontLoadingIndicator, }) => {
|
|
49
|
+
const MapplesApp = ({ children, style, assets, navigation, showFontLoadingIndicator, FontLoadingIndicator, }) => {
|
|
48
50
|
const [loaded] = useFonts(remapFonts(assets));
|
|
49
51
|
if (!loaded && showFontLoadingIndicator) {
|
|
50
52
|
return FontLoadingIndicator || null;
|
|
51
53
|
}
|
|
52
54
|
return (<StyleProvider style={Styler.init(style)}>
|
|
53
55
|
<RenderProvider components={{ ...Components, ...UIComponents }} assets={assets}>
|
|
54
|
-
{
|
|
56
|
+
<NavigationProvider navigation={navigation}>
|
|
57
|
+
{children}
|
|
58
|
+
</NavigationProvider>
|
|
55
59
|
</RenderProvider>
|
|
56
60
|
</StyleProvider>);
|
|
57
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapplesAppProvider.js","sourceRoot":"","sources":["../src/MapplesAppProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAa,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAoB,aAAa,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"MapplesAppProvider.js","sourceRoot":"","sources":["../src/MapplesAppProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAa,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAoB,aAAa,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAiB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAoBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,UAAU,GAA2C,CAAC,EAC1D,QAAQ,EACR,KAAK,EACL,MAAM,EACN,UAAU,EACV,wBAAwB,EACxB,oBAAoB,GACrB,EAAE,EAAE;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAE9C,IAAI,CAAC,MAAM,IAAI,wBAAwB,EAAE,CAAC;QACxC,OAAO,oBAAoB,IAAI,IAAI,CAAC;IACtC,CAAC;IAED,OAAO,CACL,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CACvC;MAAA,CAAC,cAAc,CACb,UAAU,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,YAAY,EAAE,CAAC,CAC/C,MAAM,CAAC,CAAC,MAAM,CAAC,CAEf;QAAA,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CACzC;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,kBAAkB,CACtB;MAAA,EAAE,cAAc,CAClB;IAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Maps Mapples navigation actions to expo-router hrefs.
|
|
4
|
+
*
|
|
5
|
+
* Produced by `mapples navigation sync` (CLI) and default-exported from a
|
|
6
|
+
* generated `navigationMap.ts` placed outside the `app/` route group. The
|
|
7
|
+
* consumer passes it into {@link MapplesApp} via the `navigation` prop,
|
|
8
|
+
* mirroring how `assets` and `style` flow through the app today.
|
|
9
|
+
*
|
|
10
|
+
* @interface NavigationMap
|
|
11
|
+
*/
|
|
12
|
+
export interface NavigationMap {
|
|
13
|
+
/**
|
|
14
|
+
* Mapples action `routeName` → expo-router href. Both the qualified
|
|
15
|
+
* `navigator:route` name and (when unambiguous) the bare `route` name are
|
|
16
|
+
* emitted as keys during the naming transition.
|
|
17
|
+
*/
|
|
18
|
+
routes: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Context carrying the active {@link NavigationMap}. Defaults to an empty map
|
|
22
|
+
* so {@link useNavigationActions} no-ops gracefully when navigation isn't wired.
|
|
23
|
+
*/
|
|
24
|
+
export declare const NavigationContext: import("react").Context<NavigationMap>;
|
|
25
|
+
/**
|
|
26
|
+
* Provides a {@link NavigationMap} to the tree. Wired by `MapplesApp` /
|
|
27
|
+
* `MapplesAppProvider` alongside `StyleProvider` and `RenderProvider`.
|
|
28
|
+
*
|
|
29
|
+
* @param props.navigation - The navigation map to provide. Falls back to an
|
|
30
|
+
* empty map when omitted.
|
|
31
|
+
*/
|
|
32
|
+
export declare const NavigationProvider: FC<PropsWithChildren<{
|
|
33
|
+
navigation?: NavigationMap;
|
|
34
|
+
}>>;
|
|
35
|
+
/** Reads the active {@link NavigationMap} from context. */
|
|
36
|
+
export declare const useNavigationMap: () => NavigationMap;
|
|
37
|
+
//# sourceMappingURL=NavigationContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationContext.d.ts","sourceRoot":"","sources":["../src/NavigationContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,EAAE,EAAE,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAEzE;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAKD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,wCACsB,CAAC;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,EAAE,CACjC,iBAAiB,CAAC;IAAE,UAAU,CAAC,EAAE,aAAa,CAAA;CAAE,CAAC,CAKlD,CAAC;AAEF,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,QAAO,aACL,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
/** Empty map used when no navigation configuration is provided. */
|
|
3
|
+
const EMPTY_NAVIGATION_MAP = { routes: {} };
|
|
4
|
+
/**
|
|
5
|
+
* Context carrying the active {@link NavigationMap}. Defaults to an empty map
|
|
6
|
+
* so {@link useNavigationActions} no-ops gracefully when navigation isn't wired.
|
|
7
|
+
*/
|
|
8
|
+
export const NavigationContext = createContext(EMPTY_NAVIGATION_MAP);
|
|
9
|
+
/**
|
|
10
|
+
* Provides a {@link NavigationMap} to the tree. Wired by `MapplesApp` /
|
|
11
|
+
* `MapplesAppProvider` alongside `StyleProvider` and `RenderProvider`.
|
|
12
|
+
*
|
|
13
|
+
* @param props.navigation - The navigation map to provide. Falls back to an
|
|
14
|
+
* empty map when omitted.
|
|
15
|
+
*/
|
|
16
|
+
export const NavigationProvider = ({ navigation, children }) => (<NavigationContext.Provider value={navigation ?? EMPTY_NAVIGATION_MAP}>
|
|
17
|
+
{children}
|
|
18
|
+
</NavigationContext.Provider>);
|
|
19
|
+
/** Reads the active {@link NavigationMap} from context. */
|
|
20
|
+
export const useNavigationMap = () => useContext(NavigationContext);
|
|
21
|
+
//# sourceMappingURL=NavigationContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationContext.js","sourceRoot":"","sources":["../src/NavigationContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAyB,UAAU,EAAE,MAAM,OAAO,CAAC;AAqBzE,mEAAmE;AACnE,MAAM,oBAAoB,GAAkB,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAC5B,aAAa,CAAgB,oBAAoB,CAAC,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAE3B,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAChC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,UAAU,IAAI,oBAAoB,CAAC,CACpE;IAAA,CAAC,QAAQ,CACX;EAAA,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAC9B,CAAC;AAEF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAkB,EAAE,CAClD,UAAU,CAAC,iBAAiB,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,9 @@ export { default } from './MapplesApp';
|
|
|
10
10
|
export type { MapplesAppProps } from './MapplesApp';
|
|
11
11
|
export { normalizeKey, remapFonts } from './utils';
|
|
12
12
|
export { default as MapplesAppProvider } from './MapplesAppProvider';
|
|
13
|
+
export type { NavigationMap } from './NavigationContext';
|
|
14
|
+
export { NavigationContext, NavigationProvider, useNavigationMap, } from './NavigationContext';
|
|
15
|
+
export { useNavigationActions } from './useNavigationActions';
|
|
16
|
+
export { createNavigationDispatch } from './navigationDispatch';
|
|
17
|
+
export type { RouterLike, NavigationLike } from './navigationDispatch';
|
|
13
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,4 +9,7 @@
|
|
|
9
9
|
export { default } from './MapplesApp';
|
|
10
10
|
export { normalizeKey, remapFonts } from './utils';
|
|
11
11
|
export { default as MapplesAppProvider } from './MapplesAppProvider';
|
|
12
|
+
export { NavigationContext, NavigationProvider, useNavigationMap, } from './NavigationContext';
|
|
13
|
+
export { useNavigationActions } from './useNavigationActions';
|
|
14
|
+
export { createNavigationDispatch } from './navigationDispatch';
|
|
12
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Action } from '@mapples/types';
|
|
2
|
+
import { NavigationMap } from './NavigationContext';
|
|
3
|
+
/** Minimal structural slice of expo-router's `useRouter()` we depend on. */
|
|
4
|
+
export interface RouterLike {
|
|
5
|
+
push: (href: {
|
|
6
|
+
pathname: string;
|
|
7
|
+
params?: Record<string, unknown>;
|
|
8
|
+
}) => void;
|
|
9
|
+
canGoBack: () => boolean;
|
|
10
|
+
back: () => void;
|
|
11
|
+
}
|
|
12
|
+
/** Minimal structural slice of React Navigation's `useNavigation()`. */
|
|
13
|
+
export interface NavigationLike {
|
|
14
|
+
dispatch: (action: {
|
|
15
|
+
type: string;
|
|
16
|
+
}) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build the navigation action dispatcher from a resolved route map and the
|
|
20
|
+
* router/navigation objects. Pure (no React, no expo-router) so the per-action
|
|
21
|
+
* behaviour can be unit-tested without a renderer or native modules.
|
|
22
|
+
*
|
|
23
|
+
* Logic is ported verbatim from the CLI's `MapplesActions.ts.tmpl` bridge.
|
|
24
|
+
*/
|
|
25
|
+
export declare const createNavigationDispatch: (routes: NavigationMap["routes"], router: RouterLike, navigation: NavigationLike) => (action: Action) => void;
|
|
26
|
+
//# sourceMappingURL=navigationDispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigationDispatch.d.ts","sourceRoot":"","sources":["../src/navigationDispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,4EAA4E;AAC5E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7E,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GAEjC,QAAQ,aAAa,CAAC,QAAQ,CAAC,EAC/B,QAAQ,UAAU,EAClB,YAAY,cAAc,MAE3B,QAAQ,MAAM,KAAG,IAqCjB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the navigation action dispatcher from a resolved route map and the
|
|
3
|
+
* router/navigation objects. Pure (no React, no expo-router) so the per-action
|
|
4
|
+
* behaviour can be unit-tested without a renderer or native modules.
|
|
5
|
+
*
|
|
6
|
+
* Logic is ported verbatim from the CLI's `MapplesActions.ts.tmpl` bridge.
|
|
7
|
+
*/
|
|
8
|
+
export const createNavigationDispatch = (routes, router, navigation) => (action) => {
|
|
9
|
+
// Read the action structurally — the action shape is owned by
|
|
10
|
+
// `@mapples/render`/the canvas, not by this package.
|
|
11
|
+
const a = action;
|
|
12
|
+
const data = a.payload?.data ?? {};
|
|
13
|
+
switch (a.type) {
|
|
14
|
+
case 'mapples:navigate':
|
|
15
|
+
case 'mapples:switchTab': {
|
|
16
|
+
const href = data.routeName ? routes[data.routeName] : undefined;
|
|
17
|
+
if (href) {
|
|
18
|
+
router.push({ pathname: href, params: data.params });
|
|
19
|
+
}
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case 'mapples:goBack':
|
|
23
|
+
if (router.canGoBack()) {
|
|
24
|
+
router.back();
|
|
25
|
+
}
|
|
26
|
+
break;
|
|
27
|
+
case 'mapples:openDrawer':
|
|
28
|
+
case 'mapples:closeDrawer':
|
|
29
|
+
// Dispatch by canonical React Navigation type string, avoiding a hard
|
|
30
|
+
// import of `@react-navigation/drawer` (optional for drawer apps).
|
|
31
|
+
navigation.dispatch({
|
|
32
|
+
type: a.type === 'mapples:openDrawer' ? 'OPEN_DRAWER' : 'CLOSE_DRAWER',
|
|
33
|
+
});
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=navigationDispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigationDispatch.js","sourceRoot":"","sources":["../src/navigationDispatch.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GACnC,CACE,MAA+B,EAC/B,MAAkB,EAClB,UAA0B,EAC1B,EAAE,CACJ,CAAC,MAAc,EAAQ,EAAE;IACvB,8DAA8D;IAC9D,qDAAqD;IACrD,MAAM,CAAC,GAAG,MAKT,CAAC;IACF,MAAM,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC;IAEnC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACf,KAAK,kBAAkB,CAAC;QACxB,KAAK,mBAAmB,CAAC,CAAC,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACjE,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YACvD,CAAC;YACD,MAAM;QACR,CAAC;QACD,KAAK,gBAAgB;YACnB,IAAI,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;gBACvB,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,CAAC;YACD,MAAM;QACR,KAAK,oBAAoB,CAAC;QAC1B,KAAK,qBAAqB;YACxB,sEAAsE;YACtE,mEAAmE;YACnE,UAAU,CAAC,QAAQ,CAAC;gBAClB,IAAI,EACF,CAAC,CAAC,IAAI,KAAK,oBAAoB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc;aACnE,CAAC,CAAC;YACH,MAAM;QACR;YACE,MAAM;IACV,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Action } from '@mapples/types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook that bridges Mapples **navigation** actions to expo-router. It reads the
|
|
4
|
+
* {@link NavigationMap} from context and uses expo-router's `useRouter` +
|
|
5
|
+
* `useNavigation`. Generated route wrappers call this and feed the result into
|
|
6
|
+
* the Mapplet's `onAction` (composed with general action dispatch).
|
|
7
|
+
*
|
|
8
|
+
* Scope: navigation actions only (`mapples:navigate`, `mapples:switchTab`,
|
|
9
|
+
* `mapples:goBack`, `mapples:openDrawer`, `mapples:closeDrawer`). Unknown or
|
|
10
|
+
* unmapped routes are no-ops.
|
|
11
|
+
*
|
|
12
|
+
* Only imported from generated route wrappers, which render inside the
|
|
13
|
+
* expo-router context — non-navigation apps never reach this module, hence
|
|
14
|
+
* `expo-router` is an optional peer dependency.
|
|
15
|
+
*
|
|
16
|
+
* @returns A handler `(action: Action) => void`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const useNavigationActions: () => ((action: Action) => void);
|
|
19
|
+
//# sourceMappingURL=useNavigationActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNavigationActions.d.ts","sourceRoot":"","sources":["../src/useNavigationActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAU7C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,QAAO,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAMhE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useRouter, useNavigation } from 'expo-router';
|
|
2
|
+
import { useNavigationMap } from './NavigationContext';
|
|
3
|
+
import { createNavigationDispatch, } from './navigationDispatch';
|
|
4
|
+
/**
|
|
5
|
+
* Hook that bridges Mapples **navigation** actions to expo-router. It reads the
|
|
6
|
+
* {@link NavigationMap} from context and uses expo-router's `useRouter` +
|
|
7
|
+
* `useNavigation`. Generated route wrappers call this and feed the result into
|
|
8
|
+
* the Mapplet's `onAction` (composed with general action dispatch).
|
|
9
|
+
*
|
|
10
|
+
* Scope: navigation actions only (`mapples:navigate`, `mapples:switchTab`,
|
|
11
|
+
* `mapples:goBack`, `mapples:openDrawer`, `mapples:closeDrawer`). Unknown or
|
|
12
|
+
* unmapped routes are no-ops.
|
|
13
|
+
*
|
|
14
|
+
* Only imported from generated route wrappers, which render inside the
|
|
15
|
+
* expo-router context — non-navigation apps never reach this module, hence
|
|
16
|
+
* `expo-router` is an optional peer dependency.
|
|
17
|
+
*
|
|
18
|
+
* @returns A handler `(action: Action) => void`.
|
|
19
|
+
*/
|
|
20
|
+
export const useNavigationActions = () => {
|
|
21
|
+
const { routes } = useNavigationMap();
|
|
22
|
+
const router = useRouter();
|
|
23
|
+
const navigation = useNavigation();
|
|
24
|
+
return createNavigationDispatch(routes, router, navigation);
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=useNavigationActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNavigationActions.js","sourceRoot":"","sources":["../src/useNavigationActions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,wBAAwB,GAGzB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAA+B,EAAE;IACnE,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,SAAS,EAA2B,CAAC;IACpD,MAAM,UAAU,GAAG,aAAa,EAA+B,CAAC;IAEhE,OAAO,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAC9D,CAAC,CAAC"}
|
package/expo/index.js
CHANGED
|
@@ -24,6 +24,17 @@ const mapplesResolver = (resolver) => (context, moduleName, platform) => {
|
|
|
24
24
|
return context.resolveRequest(context, assetsPath, platform);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
if (moduleName === 'mapples::navigation') {
|
|
28
|
+
const config = JSON.parse(
|
|
29
|
+
fs.readFileSync(path.resolve('./.mapplesrc.json'), 'utf-8'),
|
|
30
|
+
);
|
|
31
|
+
const navigationMap = path.resolve(
|
|
32
|
+
`./${config.sourceDir}/${config.dirs.navigation}/navigationMap`,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return context.resolveRequest(context, navigationMap, platform);
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
if (resolver) {
|
|
28
39
|
return resolver(context, moduleName, platform);
|
|
29
40
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapples/app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"watch": "tsc -b --watch tsconfig.build.json",
|
|
9
9
|
"lint": "eslint .",
|
|
10
10
|
"type-check": "tsc --noEmit",
|
|
11
|
+
"test": "jest",
|
|
11
12
|
"clean": "rm -rf dist"
|
|
12
13
|
},
|
|
13
14
|
"author": {
|
|
@@ -21,11 +22,17 @@
|
|
|
21
22
|
"directory": "packages/@mapples/app"
|
|
22
23
|
},
|
|
23
24
|
"peerDependencies": {
|
|
25
|
+
"expo-router": ">=56.0.0 <57",
|
|
24
26
|
"react": ">=18.0.0 <20.0.0",
|
|
25
27
|
"react-native": ">=0.71.0"
|
|
26
28
|
},
|
|
29
|
+
"peerDependenciesMeta": {
|
|
30
|
+
"expo-router": {
|
|
31
|
+
"optional": true
|
|
32
|
+
}
|
|
33
|
+
},
|
|
27
34
|
"devDependencies": {
|
|
28
|
-
"typescript": "~
|
|
35
|
+
"typescript": "~6.0.3"
|
|
29
36
|
},
|
|
30
37
|
"files": [
|
|
31
38
|
"dist",
|