@mapples/navigation 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.
Files changed (66) hide show
  1. package/README.md +46 -0
  2. package/dist/MapplesNavigation.d.ts +10 -0
  3. package/dist/MapplesNavigation.d.ts.map +1 -0
  4. package/dist/MapplesNavigation.js +30 -0
  5. package/dist/MapplesNavigation.js.map +1 -0
  6. package/dist/NavigationActionHandler.d.ts +14 -0
  7. package/dist/NavigationActionHandler.d.ts.map +1 -0
  8. package/dist/NavigationActionHandler.js +50 -0
  9. package/dist/NavigationActionHandler.js.map +1 -0
  10. package/dist/actionCommands.d.ts +11 -0
  11. package/dist/actionCommands.d.ts.map +1 -0
  12. package/dist/actionCommands.js +45 -0
  13. package/dist/actionCommands.js.map +1 -0
  14. package/dist/buildNavigator.d.ts +14 -0
  15. package/dist/buildNavigator.d.ts.map +1 -0
  16. package/dist/buildNavigator.js +87 -0
  17. package/dist/buildNavigator.js.map +1 -0
  18. package/dist/constants.d.ts +19 -0
  19. package/dist/constants.d.ts.map +1 -0
  20. package/dist/constants.js +18 -0
  21. package/dist/constants.js.map +1 -0
  22. package/dist/index.d.ts +18 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +17 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/mappers/drawerOptions.d.ts +5 -0
  27. package/dist/mappers/drawerOptions.d.ts.map +1 -0
  28. package/dist/mappers/drawerOptions.js +26 -0
  29. package/dist/mappers/drawerOptions.js.map +1 -0
  30. package/dist/mappers/headerOptions.d.ts +10 -0
  31. package/dist/mappers/headerOptions.d.ts.map +1 -0
  32. package/dist/mappers/headerOptions.js +42 -0
  33. package/dist/mappers/headerOptions.js.map +1 -0
  34. package/dist/mappers/index.d.ts +5 -0
  35. package/dist/mappers/index.d.ts.map +1 -0
  36. package/dist/mappers/index.js +5 -0
  37. package/dist/mappers/index.js.map +1 -0
  38. package/dist/mappers/screenOptions.d.ts +13 -0
  39. package/dist/mappers/screenOptions.d.ts.map +1 -0
  40. package/dist/mappers/screenOptions.js +37 -0
  41. package/dist/mappers/screenOptions.js.map +1 -0
  42. package/dist/mappers/tabBarOptions.d.ts +5 -0
  43. package/dist/mappers/tabBarOptions.d.ts.map +1 -0
  44. package/dist/mappers/tabBarOptions.js +37 -0
  45. package/dist/mappers/tabBarOptions.js.map +1 -0
  46. package/dist/model.d.ts +90 -0
  47. package/dist/model.d.ts.map +1 -0
  48. package/dist/model.js +189 -0
  49. package/dist/model.js.map +1 -0
  50. package/dist/refs.d.ts +15 -0
  51. package/dist/refs.d.ts.map +1 -0
  52. package/dist/refs.js +21 -0
  53. package/dist/refs.js.map +1 -0
  54. package/dist/types.d.ts +126 -0
  55. package/dist/types.d.ts.map +1 -0
  56. package/dist/types.js +1 -0
  57. package/dist/types.js.map +1 -0
  58. package/dist/useRefResolvers.d.ts +10 -0
  59. package/dist/useRefResolvers.d.ts.map +1 -0
  60. package/dist/useRefResolvers.js +64 -0
  61. package/dist/useRefResolvers.js.map +1 -0
  62. package/dist/vendor.d.ts +29 -0
  63. package/dist/vendor.d.ts.map +1 -0
  64. package/dist/vendor.js +29 -0
  65. package/dist/vendor.js.map +1 -0
  66. package/package.json +46 -0
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # @mapples/navigation
2
+
3
+ Runtime interpreter for the Mapples `NavigationDocument`. Renders a document with
4
+ React Navigation (stack / tabs / drawer) and bridges navigation actions emitted
5
+ through `@mapples/action`.
6
+
7
+ > ⚠️ **Canonical home is `mapples-open-kit`.** This copy is the in-monorepo mirror
8
+ > used so the Creator preview can develop against it. Sync changes to open-kit
9
+ > before publishing; do not release from this repo.
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ import { MapplesNavigation } from '@mapples/navigation';
15
+
16
+ <MapplesNavigation
17
+ document={navigationDocument}
18
+ pages={{ 'page-uuid': HomeScreen }}
19
+ fallback={({ pageUuid }) => <Missing pageUuid={pageUuid} />}
20
+ independent // when the host already owns a NavigationContainer (expo-router)
21
+ />;
22
+ ```
23
+
24
+ ## Actions
25
+
26
+ Components emit these `Action.type` strings (see `NavigationActionType`):
27
+
28
+ | Type | `payload.data` | Effect |
29
+ | --- | --- | --- |
30
+ | `mapples:navigate` | `{ routeName?, pageUuid?, params? }` | Navigate to a route / page |
31
+ | `mapples:goBack` | — | Pop the current screen |
32
+ | `mapples:openDrawer` | — | Open the nearest drawer |
33
+ | `mapples:closeDrawer` | — | Close the nearest drawer |
34
+ | `mapples:switchTab` | `{ routeName }` | Switch to a sibling tab |
35
+
36
+ ## Ref resolution
37
+
38
+ Option values may be `ref(theme:<uuid>:<name>)` (resolved against `@mapples/style`)
39
+ or `ref(icon:<uuid>:<name>)` (resolved against the `@mapples/render` assets map).
40
+ Unresolvable refs fall back to a default and `console.warn` rather than crashing.
41
+
42
+ ## Peer dependencies
43
+
44
+ `@react-navigation/*` ship as direct dependencies; `react-native-screens`,
45
+ `react-native-safe-area-context`, `react-native-gesture-handler` and
46
+ `react-native-reanimated` are peer dependencies provided by the host app.
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ import { MapplesNavigationProps } from './types';
3
+ /**
4
+ * Renders a {@link NavigationDocument} with React Navigation and wires the
5
+ * `@mapples/action` store to navigation. Pass `independent` when the host app
6
+ * already owns a navigation container (expo-router / the Creator preview).
7
+ */
8
+ declare const MapplesNavigation: FC<MapplesNavigationProps>;
9
+ export default MapplesNavigation;
10
+ //# sourceMappingURL=MapplesNavigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapplesNavigation.d.ts","sourceRoot":"","sources":["../src/MapplesNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAKpC,OAAO,EAAE,sBAAsB,EAAwB,MAAM,SAAS,CAAC;AAQvE;;;;GAIG;AACH,QAAA,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAqCjD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { useMemo } from 'react';
2
+ import { NavigatorView } from './buildNavigator';
3
+ import { buildNavigationModel } from './model';
4
+ import NavigationActionHandler from './NavigationActionHandler';
5
+ import useRefResolvers from './useRefResolvers';
6
+ import { createNavigationContainerRef, NavigationContainer, NavigationIndependentTree, } from './vendor';
7
+ /**
8
+ * Renders a {@link NavigationDocument} with React Navigation and wires the
9
+ * `@mapples/action` store to navigation. Pass `independent` when the host app
10
+ * already owns a navigation container (expo-router / the Creator preview).
11
+ */
12
+ const MapplesNavigation = ({ document, pages, fallback, independent, navigationRef: externalRef, }) => {
13
+ const resolvers = useRefResolvers();
14
+ const model = useMemo(() => buildNavigationModel(document), [document]);
15
+ const internalRef = useMemo(() => createNavigationContainerRef(), []);
16
+ const navigationRef = externalRef ?? internalRef;
17
+ if (!model)
18
+ return null;
19
+ const ctx = { pages, fallback, resolvers };
20
+ const container = (<NavigationContainer ref={navigationRef}>
21
+ <NavigatorView model={model} ctx={ctx}/>
22
+ </NavigationContainer>);
23
+ const tree = independent ? (<NavigationIndependentTree>{container}</NavigationIndependentTree>) : (container);
24
+ return (<>
25
+ {tree}
26
+ <NavigationActionHandler navigationRef={navigationRef} document={document}/>
27
+ </>);
28
+ };
29
+ export default MapplesNavigation;
30
+ //# sourceMappingURL=MapplesNavigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapplesNavigation.js","sourceRoot":"","sources":["../src/MapplesNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAM,OAAO,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,yBAAyB,GAC1B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
+ import { MapplesNavigationRef } from './types';
3
+ interface NavigationActionHandlerProps {
4
+ navigationRef: MapplesNavigationRef;
5
+ document: NavigationDocument;
6
+ }
7
+ /**
8
+ * Bridges the `@mapples/action` store to navigation: it subscribes to emitted
9
+ * actions, maps each to a {@link toNavigationCommand} command, and drives the
10
+ * shared navigation container ref. Renders nothing.
11
+ */
12
+ declare const NavigationActionHandler: ({ navigationRef, document, }: NavigationActionHandlerProps) => null;
13
+ export default NavigationActionHandler;
14
+ //# sourceMappingURL=NavigationActionHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationActionHandler.d.ts","sourceRoot":"","sources":["../src/NavigationActionHandler.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAG/C,UAAU,4BAA4B;IACpC,aAAa,EAAE,oBAAoB,CAAC;IACpC,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED;;;;GAIG;AACH,QAAA,MAAM,uBAAuB,GAAI,8BAG9B,4BAA4B,SAyC9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { useEffect } from 'react';
2
+ import { useActionStore } from '@mapples/action';
3
+ import { toNavigationCommand } from './actionCommands';
4
+ import { buildScreenNavigateTarget } from './model';
5
+ import { DrawerActions } from './vendor';
6
+ /**
7
+ * Bridges the `@mapples/action` store to navigation: it subscribes to emitted
8
+ * actions, maps each to a {@link toNavigationCommand} command, and drives the
9
+ * shared navigation container ref. Renders nothing.
10
+ */
11
+ const NavigationActionHandler = ({ navigationRef, document, }) => {
12
+ const actionStore = useActionStore();
13
+ useEffect(() => {
14
+ const subscription = actionStore.subscribe((action) => {
15
+ const command = toNavigationCommand(action, document);
16
+ if (!command || !navigationRef.isReady())
17
+ return;
18
+ switch (command.kind) {
19
+ case 'navigate': {
20
+ // Descend into nested navigators: a flat `navigate(name)` can't reach
21
+ // a screen registered inside a nested navigator.
22
+ const target = buildScreenNavigateTarget(document, command.routeName, command.params);
23
+ if (target)
24
+ navigationRef.navigate(target.name, target.params);
25
+ break;
26
+ }
27
+ case 'switchTab': {
28
+ const target = buildScreenNavigateTarget(document, command.routeName);
29
+ if (target)
30
+ navigationRef.navigate(target.name, target.params);
31
+ break;
32
+ }
33
+ case 'goBack':
34
+ if (navigationRef.canGoBack())
35
+ navigationRef.goBack();
36
+ break;
37
+ case 'openDrawer':
38
+ navigationRef.dispatch(DrawerActions.openDrawer());
39
+ break;
40
+ case 'closeDrawer':
41
+ navigationRef.dispatch(DrawerActions.closeDrawer());
42
+ break;
43
+ }
44
+ });
45
+ return () => subscription.unsubscribe();
46
+ }, [actionStore, document, navigationRef]);
47
+ return null;
48
+ };
49
+ export default NavigationActionHandler;
50
+ //# sourceMappingURL=NavigationActionHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationActionHandler.js","sourceRoot":"","sources":["../src/NavigationActionHandler.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAOzC;;;;GAIG;AACH,MAAM,uBAAuB,GAAG,CAAC,EAC/B,aAAa,EACb,QAAQ,GACqB,EAAE,EAAE;IACjC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE;YACpD,MAAM,OAAO,GAAG,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACtD,IAAI,CAA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NavigationDocument } from '@mapples/types';
2
+ import { NavigationCommand } from './types';
3
+ /**
4
+ * Translate an emitted {@link Action} into a {@link NavigationCommand}, or
5
+ * `null` if it isn't a navigation action (or can't be resolved). `pageUuid`
6
+ * navigate targets resolve to the first route referencing that page.
7
+ *
8
+ * Pure: no React Navigation involvement, so it can be unit-tested directly.
9
+ */
10
+ export declare const toNavigationCommand: (action: Action, document: NavigationDocument) => NavigationCommand | null;
11
+ //# sourceMappingURL=actionCommands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actionCommands.d.ts","sourceRoot":"","sources":["../src/actionCommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAI5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAS5C;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,MAAM,EACd,UAAU,kBAAkB,KAC3B,iBAAiB,GAAG,IA+BtB,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { NavigationActionType } from './constants';
2
+ import { findRouteNameForPage, resolveScreenName } from './model';
3
+ /**
4
+ * Translate an emitted {@link Action} into a {@link NavigationCommand}, or
5
+ * `null` if it isn't a navigation action (or can't be resolved). `pageUuid`
6
+ * navigate targets resolve to the first route referencing that page.
7
+ *
8
+ * Pure: no React Navigation involvement, so it can be unit-tested directly.
9
+ */
10
+ export const toNavigationCommand = (action, document) => {
11
+ switch (action.type) {
12
+ case NavigationActionType.Navigate: {
13
+ const data = (action.payload?.data ?? {});
14
+ // `findRouteNameForPage` already returns a qualified name; an explicit
15
+ // `routeName` may be qualified (current) or bare (legacy), so both pass
16
+ // through `resolveScreenName`.
17
+ const target = data.routeName ??
18
+ (data.pageUuid ? findRouteNameForPage(document, data.pageUuid) : null);
19
+ if (!target)
20
+ return null;
21
+ const routeName = resolveScreenName(document, target);
22
+ if (!routeName)
23
+ return null;
24
+ return { kind: 'navigate', routeName, params: data.params };
25
+ }
26
+ case NavigationActionType.GoBack:
27
+ return { kind: 'goBack' };
28
+ case NavigationActionType.OpenDrawer:
29
+ return { kind: 'openDrawer' };
30
+ case NavigationActionType.CloseDrawer:
31
+ return { kind: 'closeDrawer' };
32
+ case NavigationActionType.SwitchTab: {
33
+ const data = (action.payload?.data ?? {});
34
+ if (!data.routeName)
35
+ return null;
36
+ const routeName = resolveScreenName(document, data.routeName);
37
+ if (!routeName)
38
+ return null;
39
+ return { kind: 'switchTab', routeName };
40
+ }
41
+ default:
42
+ return null;
43
+ }
44
+ };
45
+ //# sourceMappingURL=actionCommands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actionCommands.js","sourceRoot":"","sources":["../src/actionCommands.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAUlE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,MAAc,EACd,QAA4B,EACF,EAAE;IAC5B,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnC,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAoB,CAAC;YAC7D,uEAAuE;YACvE,wEAAwE;YACxE,+BAA+B;YAC/B,MAAM,MAAM,GACV,IAAI,CAAC,SAAS;gBACd,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACzE,IAAI,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YACzB,MAAM,SAAS,GAAG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACtD,IAAI,CAAC,SAAS;gBAAE,OAAO,IAAI,CAAC;YAC5B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QAC9D,CAAC;QACD,KAAK,oBAAoB,CAAC,MAAM;YAC9B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAC5B,KAAK,oBAAoB,CAAC,UAAU;YAClC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;QAChC,KAAK,oBAAoB,CAAC,WAAW;YACnC,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QACjC,KAAK,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC;YACpC,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAoB,CAAC;YAC7D,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,OAAO,IAAI,CAAC;YACjC,MAAM,SAAS,GAAG,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAC9D,IAAI,CAAC,SAAS;gBAAE,OAAO,IAAI,CAAC;YAC5B,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;QAC1C,CAAC;QACD;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { NavigatorModel } from './model';
2
+ import { MapplesNavigationProps, RefResolvers } from './types';
3
+ /** Everything a navigator needs to resolve its screens. */
4
+ export interface NavigatorBuildContext {
5
+ pages: MapplesNavigationProps['pages'];
6
+ fallback?: MapplesNavigationProps['fallback'];
7
+ resolvers: RefResolvers;
8
+ }
9
+ /** Recursively render a {@link NavigatorModel} with the matching React Navigation navigator. */
10
+ export declare const NavigatorView: ({ model, ctx, }: {
11
+ model: NavigatorModel;
12
+ ctx: NavigatorBuildContext;
13
+ }) => import("react").JSX.Element;
14
+ //# sourceMappingURL=buildNavigator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildNavigator.d.ts","sourceRoot":"","sources":["../src/buildNavigator.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAe,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAS/D,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC9C,SAAS,EAAE,YAAY,CAAC;CACzB;AA4LD,gGAAgG;AAChG,eAAO,MAAM,aAAa,GAAI,iBAG3B;IACD,KAAK,EAAE,cAAc,CAAC;IACtB,GAAG,EAAE,qBAAqB,CAAC;CAC5B,gCASA,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { useMemo } from 'react';
2
+ import { Text, View } from 'react-native';
3
+ // React Navigation is consumed through expo-router's vendored copy, centralized
4
+ // in `./vendor` (SDK 56+ blocks external `@react-navigation/*`).
5
+ import { mapDrawerItemOptions, mapDrawerOptions, mapHeaderOptions, mapStackScreenOptions, mapTabBarOptions, mapTabItemOptions, } from './mappers';
6
+ import { createBottomTabNavigator, createDrawerNavigator, createNativeStackNavigator, } from './vendor';
7
+ const MissingScreen = () => null;
8
+ /**
9
+ * React Navigation requires every navigator to have at least one screen. A
10
+ * navigator with no routes is a valid intermediate state in the editor (you
11
+ * create it, then add screens), so render a single placeholder rather than
12
+ * crashing.
13
+ */
14
+ const EMPTY_ROUTE_NAME = '__mapples_empty__';
15
+ // Blank the header title / tab / drawer label so the internal placeholder route
16
+ // name never leaks into the preview chrome.
17
+ const EMPTY_SCREEN_OPTIONS = { title: '' };
18
+ const EmptyNavigatorScreen = () => (<View style={{
19
+ flex: 1,
20
+ alignItems: 'center',
21
+ justifyContent: 'center',
22
+ padding: 24,
23
+ }}>
24
+ <Text style={{ color: '#8E8E93', fontSize: 13, textAlign: 'center' }}>
25
+ No screens yet. Add a screen to this navigator.
26
+ </Text>
27
+ </View>);
28
+ /** Resolve the component a screen renders (page lookup → pages map / fallback). */
29
+ const screenComponent = (screen, ctx) => {
30
+ if (screen.target.kind === 'navigator') {
31
+ const child = screen.target.child;
32
+ const Child = () => (<NavigatorView model={child} ctx={ctx}/>);
33
+ return Child;
34
+ }
35
+ const { pageUuid } = screen.target;
36
+ const Page = ctx.pages[pageUuid];
37
+ if (Page)
38
+ return Page;
39
+ if (ctx.fallback) {
40
+ const Fallback = ctx.fallback;
41
+ const FallbackScreen = () => (<Fallback pageUuid={pageUuid}/>);
42
+ return FallbackScreen;
43
+ }
44
+ return MissingScreen;
45
+ };
46
+ const StackNavigatorView = ({ model, ctx, }) => {
47
+ const Stack = useMemo(() => createNativeStackNavigator(), []);
48
+ // When neither the navigator nor the route sets a header title, React
49
+ // Navigation falls back to the screen name — which is now navigator-qualified
50
+ // (`<navigator>:<route>`). Default the title to the bare route name in that
51
+ // case so the prefix never surfaces in the UI; a navigator-level title still
52
+ // applies to every screen as before.
53
+ const navHasTitle = model.node.options?.header?.title !== undefined;
54
+ return (<Stack.Navigator initialRouteName={model.initialRouteName} screenOptions={mapHeaderOptions(model.node.options?.header, ctx.resolvers)}>
55
+ {model.screens.length ? (model.screens.map((screen) => {
56
+ const options = mapStackScreenOptions(screen.route, ctx.resolvers);
57
+ if (options.title === undefined && !navHasTitle) {
58
+ options.title = screen.route.name;
59
+ }
60
+ return (<Stack.Screen key={screen.routeId} name={screen.routeName} component={screenComponent(screen, ctx)} options={options}/>);
61
+ })) : (<Stack.Screen name={EMPTY_ROUTE_NAME} component={EmptyNavigatorScreen} options={EMPTY_SCREEN_OPTIONS}/>)}
62
+ </Stack.Navigator>);
63
+ };
64
+ const TabsNavigatorView = ({ model, ctx, }) => {
65
+ const Tabs = useMemo(() => createBottomTabNavigator(), []);
66
+ return (<Tabs.Navigator initialRouteName={model.initialRouteName} screenOptions={mapTabBarOptions(model.node.options?.tabBar, ctx.resolvers)}>
67
+ {model.screens.length ? (model.screens.map((screen) => (<Tabs.Screen key={screen.routeId} name={screen.routeName} component={screenComponent(screen, ctx)} options={mapTabItemOptions(screen.route, ctx.resolvers)}/>))) : (<Tabs.Screen name={EMPTY_ROUTE_NAME} component={EmptyNavigatorScreen} options={EMPTY_SCREEN_OPTIONS}/>)}
68
+ </Tabs.Navigator>);
69
+ };
70
+ const DrawerNavigatorView = ({ model, ctx, }) => {
71
+ const Drawer = useMemo(() => createDrawerNavigator(), []);
72
+ return (<Drawer.Navigator initialRouteName={model.initialRouteName} screenOptions={mapDrawerOptions(model.node.options?.drawer, ctx.resolvers)}>
73
+ {model.screens.length ? (model.screens.map((screen) => (<Drawer.Screen key={screen.routeId} name={screen.routeName} component={screenComponent(screen, ctx)} options={mapDrawerItemOptions(screen.route, ctx.resolvers)}/>))) : (<Drawer.Screen name={EMPTY_ROUTE_NAME} component={EmptyNavigatorScreen} options={EMPTY_SCREEN_OPTIONS}/>)}
74
+ </Drawer.Navigator>);
75
+ };
76
+ /** Recursively render a {@link NavigatorModel} with the matching React Navigation navigator. */
77
+ export const NavigatorView = ({ model, ctx, }) => {
78
+ switch (model.type) {
79
+ case 'tabs':
80
+ return <TabsNavigatorView model={model} ctx={ctx}/>;
81
+ case 'drawer':
82
+ return <DrawerNavigatorView model={model} ctx={ctx}/>;
83
+ default:
84
+ return <StackNavigatorView model={model} ctx={ctx}/>;
85
+ }
86
+ };
87
+ //# sourceMappingURL=buildNavigator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildNavigator.js","sourceRoot":"","sources":["../src/buildNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,OAAO,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1C,gFAAgF;AAChF,iEAAiE;AACjE,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,gB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ACD,CACH,CAAC,CACH,CAAC,CAAC,CAAC,CACF,CAAC,MAAM,CAAC,MAAM,CACZ,IAAI,CAAC,CAAC,gBAAgB,CAAC,CACvB,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAChC,OAAO,CAAC,CAAC,oBAAoB,CAAC,EAC9B,CACH,CACH;IAAA,EAAE,MAAM,CAAC,SAAS,CAAC,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,gGAAgG;AAChG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC5B,KAAK,EACL,GAAG,GAIJ,EAAE,EAAE;IACH,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,MAAM;YACT,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC;QACvD,KAAK,QAAQ;YACX,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC;QACzD;YACE,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC;IAC1D,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Action `type` strings handled by the navigation runtime. Components wire these
3
+ * to interactions via `RenderComponentType.actionProps` and emit them through
4
+ * the `@mapples/action` store.
5
+ */
6
+ export declare const NavigationActionType: {
7
+ /** Navigate to a route or page. `payload.data: { routeName?, pageUuid?, params? }`. */
8
+ readonly Navigate: "mapples:navigate";
9
+ /** Pop the current screen. */
10
+ readonly GoBack: "mapples:goBack";
11
+ /** Open the nearest drawer. */
12
+ readonly OpenDrawer: "mapples:openDrawer";
13
+ /** Close the nearest drawer. */
14
+ readonly CloseDrawer: "mapples:closeDrawer";
15
+ /** Switch to a sibling tab. `payload.data: { routeName }`. */
16
+ readonly SwitchTab: "mapples:switchTab";
17
+ };
18
+ export type NavigationActionTypeValue = (typeof NavigationActionType)[keyof typeof NavigationActionType];
19
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;IAC/B,uFAAuF;;IAEvF,8BAA8B;;IAE9B,+BAA+B;;IAE/B,gCAAgC;;IAEhC,8DAA8D;;CAEtD,CAAC;AAEX,MAAM,MAAM,yBAAyB,GACnC,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Action `type` strings handled by the navigation runtime. Components wire these
3
+ * to interactions via `RenderComponentType.actionProps` and emit them through
4
+ * the `@mapples/action` store.
5
+ */
6
+ export const NavigationActionType = {
7
+ /** Navigate to a route or page. `payload.data: { routeName?, pageUuid?, params? }`. */
8
+ Navigate: 'mapples:navigate',
9
+ /** Pop the current screen. */
10
+ GoBack: 'mapples:goBack',
11
+ /** Open the nearest drawer. */
12
+ OpenDrawer: 'mapples:openDrawer',
13
+ /** Close the nearest drawer. */
14
+ CloseDrawer: 'mapples:closeDrawer',
15
+ /** Switch to a sibling tab. `payload.data: { routeName }`. */
16
+ SwitchTab: 'mapples:switchTab',
17
+ };
18
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,uFAAuF;IACvF,QAAQ,EAAE,kBAAkB;IAC5B,8BAA8B;IAC9B,MAAM,EAAE,gBAAgB;IACxB,+BAA+B;IAC/B,UAAU,EAAE,oBAAoB;IAChC,gCAAgC;IAChC,WAAW,EAAE,qBAAqB;IAClC,8DAA8D;IAC9D,SAAS,EAAE,mBAAmB;CACtB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @fileoverview Runtime interpreter for the Mapples `NavigationDocument`.
3
+ *
4
+ * Renders a navigation document with React Navigation (stack / tabs / drawer)
5
+ * and bridges navigation actions emitted through `@mapples/action`.
6
+ */
7
+ export { default as MapplesNavigation } from './MapplesNavigation';
8
+ export { default as NavigationActionHandler } from './NavigationActionHandler';
9
+ export { default as useRefResolvers } from './useRefResolvers';
10
+ export { NavigatorView } from './buildNavigator';
11
+ export type { NavigatorBuildContext } from './buildNavigator';
12
+ export * from './types';
13
+ export * from './constants';
14
+ export * from './refs';
15
+ export * from './model';
16
+ export * from './mappers';
17
+ export * from './actionCommands';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @fileoverview Runtime interpreter for the Mapples `NavigationDocument`.
3
+ *
4
+ * Renders a navigation document with React Navigation (stack / tabs / drawer)
5
+ * and bridges navigation actions emitted through `@mapples/action`.
6
+ */
7
+ export { default as MapplesNavigation } from './MapplesNavigation';
8
+ export { default as NavigationActionHandler } from './NavigationActionHandler';
9
+ export { default as useRefResolvers } from './useRefResolvers';
10
+ export { NavigatorView } from './buildNavigator';
11
+ export * from './types';
12
+ export * from './constants';
13
+ export * from './refs';
14
+ export * from './model';
15
+ export * from './mappers';
16
+ export * from './actionCommands';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { DrawerOptions } from '@mapples/types';
2
+ import { DrawerOptionsPatch, RefResolvers } from '../types';
3
+ /** Map {@link DrawerOptions} to a drawer navigator options patch. */
4
+ export declare const mapDrawerOptions: (drawer: DrawerOptions | undefined, resolvers: RefResolvers) => DrawerOptionsPatch;
5
+ //# sourceMappingURL=drawerOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawerOptions.d.ts","sourceRoot":"","sources":["../../src/mappers/drawerOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE5D,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,aAAa,GAAG,SAAS,EACjC,WAAW,YAAY,KACtB,kBAoBF,CAAC"}
@@ -0,0 +1,26 @@
1
+ /** Map {@link DrawerOptions} to a drawer navigator options patch. */
2
+ export const mapDrawerOptions = (drawer, resolvers) => {
3
+ const patch = {};
4
+ if (!drawer)
5
+ return patch;
6
+ if (drawer.position !== undefined)
7
+ patch.drawerPosition = drawer.position;
8
+ if (drawer.drawerType !== undefined)
9
+ patch.drawerType = drawer.drawerType;
10
+ const activeTintColor = resolvers.resolveColor(drawer.activeTintColor);
11
+ if (activeTintColor)
12
+ patch.drawerActiveTintColor = activeTintColor;
13
+ const inactiveTintColor = resolvers.resolveColor(drawer.inactiveTintColor);
14
+ if (inactiveTintColor)
15
+ patch.drawerInactiveTintColor = inactiveTintColor;
16
+ const style = {};
17
+ const backgroundColor = resolvers.resolveColor(drawer.backgroundColor);
18
+ if (backgroundColor)
19
+ style.backgroundColor = backgroundColor;
20
+ if (drawer.width !== undefined)
21
+ style.width = drawer.width;
22
+ if (Object.keys(style).length)
23
+ patch.drawerStyle = style;
24
+ return patch;
25
+ };
26
+ //# sourceMappingURL=drawerOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawerOptions.js","sourceRoot":"","sources":["../../src/mappers/drawerOptions.ts"],"names":[],"mappings":"AAIA,qEAAqE;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,MAAiC,EACjC,SAAuB,EACH,EAAE;IACtB,MAAM,KAAK,GAAuB,EAAE,CAAC;IACrC,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAE1B,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS;QAAE,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC1E,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAE1E,MAAM,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACvE,IAAI,eAAe;QAAE,KAAK,CAAC,qBAAqB,GAAG,eAAe,CAAC;IAEnE,MAAM,iBAAiB,GAAG,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC3E,IAAI,iBAAiB;QAAE,KAAK,CAAC,uBAAuB,GAAG,iBAAiB,CAAC;IAEzE,MAAM,KAAK,GAAmD,EAAE,CAAC;IACjE,MAAM,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACvE,IAAI,eAAe;QAAE,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;IAC7D,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3D,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM;QAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC;IAEzD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { HeaderOptions } from '@mapples/types';
2
+ import { RefResolvers, StackHeaderOptionsPatch } from '../types';
3
+ /**
4
+ * Map {@link HeaderOptions} to a native-stack header options patch. Colour
5
+ * fields are resolved through {@link RefResolvers} (so `ref(theme:…)` becomes a
6
+ * concrete colour). Only explicitly-set fields are emitted; everything else is
7
+ * left to the React Navigation default.
8
+ */
9
+ export declare const mapHeaderOptions: (header: Partial<HeaderOptions> | undefined, resolvers: RefResolvers) => StackHeaderOptionsPatch;
10
+ //# sourceMappingURL=headerOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headerOptions.d.ts","sourceRoot":"","sources":["../../src/mappers/headerOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS,EAC1C,WAAW,YAAY,KACtB,uBAiCF,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Map {@link HeaderOptions} to a native-stack header options patch. Colour
3
+ * fields are resolved through {@link RefResolvers} (so `ref(theme:…)` becomes a
4
+ * concrete colour). Only explicitly-set fields are emitted; everything else is
5
+ * left to the React Navigation default.
6
+ */
7
+ export const mapHeaderOptions = (header, resolvers) => {
8
+ const patch = {};
9
+ if (!header)
10
+ return patch;
11
+ if (header.visible !== undefined)
12
+ patch.headerShown = header.visible;
13
+ if (header.title !== undefined)
14
+ patch.title = header.title;
15
+ if (header.backVisible !== undefined)
16
+ patch.headerBackVisible = header.backVisible;
17
+ if (header.shadowVisible !== undefined) {
18
+ patch.headerShadowVisible = header.shadowVisible;
19
+ }
20
+ const backgroundColor = resolvers.resolveColor(header.backgroundColor);
21
+ if (backgroundColor)
22
+ patch.headerStyle = { backgroundColor };
23
+ const tintColor = resolvers.resolveColor(header.tintColor);
24
+ if (tintColor)
25
+ patch.headerTintColor = tintColor;
26
+ if (header.titleStyle) {
27
+ const titleStyle = {};
28
+ if (header.titleStyle.fontFamily) {
29
+ titleStyle.fontFamily = header.titleStyle.fontFamily;
30
+ }
31
+ if (header.titleStyle.fontSize !== undefined) {
32
+ titleStyle.fontSize = header.titleStyle.fontSize;
33
+ }
34
+ const color = resolvers.resolveColor(header.titleStyle.color);
35
+ if (color)
36
+ titleStyle.color = color;
37
+ if (Object.keys(titleStyle).length)
38
+ patch.headerTitleStyle = titleStyle;
39
+ }
40
+ return patch;
41
+ };
42
+ //# sourceMappingURL=headerOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headerOptions.js","sourceRoot":"","sources":["../../src/mappers/headerOptions.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,MAA0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,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC9D,IAAI,KAAK;YAAE,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC;QACpC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM;YAAE,KAAK,CAAC,gBAAgB,GAAG,UAAU,CAAC;IAC1E,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './headerOptions';
2
+ export * from './tabBarOptions';
3
+ export * from './drawerOptions';
4
+ export * from './screenOptions';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './headerOptions';
2
+ export * from './tabBarOptions';
3
+ export * from './drawerOptions';
4
+ export * from './screenOptions';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { RouteNode } from '@mapples/types';
2
+ import { DrawerItemOptionsPatch, RefResolvers, StackScreenOptionsPatch, TabItemOptionsPatch } from '../types';
3
+ /**
4
+ * Per-route native-stack options: the route's header overrides
5
+ * ({@link RouteNode.options} extends `Partial<HeaderOptions>`) plus its
6
+ * `presentation`.
7
+ */
8
+ export declare const mapStackScreenOptions: (route: RouteNode, resolvers: RefResolvers) => StackScreenOptionsPatch;
9
+ /** Per-route bottom-tabs item options (label + icon). */
10
+ export declare const mapTabItemOptions: (route: RouteNode, resolvers: RefResolvers) => TabItemOptionsPatch;
11
+ /** Per-route drawer item options (label + icon). */
12
+ export declare const mapDrawerItemOptions: (route: RouteNode, resolvers: RefResolvers) => DrawerItemOptionsPatch;
13
+ //# sourceMappingURL=screenOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screenOptions.d.ts","sourceRoot":"","sources":["../../src/mappers/screenOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAIlB;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAChC,OAAO,SAAS,EAChB,WAAW,YAAY,KACtB,uBAMF,CAAC;AAEF,yDAAyD;AACzD,eAAO,MAAM,iBAAiB,GAC5B,OAAO,SAAS,EAChB,WAAW,YAAY,KACtB,mBAQF,CAAC;AAEF,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,GAC/B,OAAO,SAAS,EAChB,WAAW,YAAY,KACtB,sBAQF,CAAC"}