expo-router 5.0.6 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/arrow_down.png +0 -0
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +3 -0
- package/build/ExpoRoot.js.map +1 -1
- package/build/exports.d.ts +1 -0
- package/build/exports.d.ts.map +1 -1
- package/build/exports.js +3 -1
- package/build/exports.js.map +1 -1
- package/build/fork/getPathFromState-forks.js +1 -4
- package/build/fork/getPathFromState-forks.js.map +1 -1
- package/build/fork/getStateFromPath-forks.d.ts +2 -0
- package/build/fork/getStateFromPath-forks.d.ts.map +1 -1
- package/build/fork/getStateFromPath-forks.js +14 -1
- package/build/fork/getStateFromPath-forks.js.map +1 -1
- package/build/fork/useLinking.d.ts.map +1 -1
- package/build/fork/useLinking.js +28 -6
- package/build/fork/useLinking.js.map +1 -1
- package/build/getReactNavigationConfig.d.ts.map +1 -1
- package/build/getReactNavigationConfig.js +8 -7
- package/build/getReactNavigationConfig.js.map +1 -1
- package/build/getRoutesCore.d.ts.map +1 -1
- package/build/getRoutesCore.js +6 -10
- package/build/getRoutesCore.js.map +1 -1
- package/build/getRoutesRedirects.d.ts.map +1 -1
- package/build/getRoutesRedirects.js +22 -16
- package/build/getRoutesRedirects.js.map +1 -1
- package/build/global-state/router-store.d.ts.map +1 -1
- package/build/global-state/router-store.js +6 -1
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.d.ts +14 -0
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +41 -6
- package/build/global-state/routing.js.map +1 -1
- package/build/hooks.d.ts.map +1 -1
- package/build/hooks.js +5 -0
- package/build/hooks.js.map +1 -1
- package/build/imperative-api.d.ts +1 -0
- package/build/imperative-api.d.ts.map +1 -1
- package/build/imperative-api.js +9 -0
- package/build/imperative-api.js.map +1 -1
- package/build/layouts/TabsClient.d.ts +3 -1
- package/build/layouts/TabsClient.d.ts.map +1 -1
- package/build/layouts/TabsClient.js +2 -0
- package/build/layouts/TabsClient.js.map +1 -1
- package/build/matchers.d.ts +6 -3
- package/build/matchers.d.ts.map +1 -1
- package/build/matchers.js +15 -11
- package/build/matchers.js.map +1 -1
- package/build/rsc/middleware.d.ts.map +1 -1
- package/build/rsc/middleware.js +15 -27
- package/build/rsc/middleware.js.map +1 -1
- package/build/typed-routes/generate.js +5 -2
- package/build/typed-routes/generate.js.map +1 -1
- package/build/useFocusEffect.d.ts +2 -2
- package/build/useFocusEffect.js +2 -2
- package/build/useFocusEffect.js.map +1 -1
- package/build/views/Navigator.d.ts.map +1 -1
- package/build/views/Navigator.js +5 -2
- package/build/views/Navigator.js.map +1 -1
- package/build/views/Sitemap.d.ts.map +1 -1
- package/build/views/Sitemap.js +56 -72
- package/build/views/Sitemap.js.map +1 -1
- package/build/views/useSitemap.d.ts +12 -0
- package/build/views/useSitemap.d.ts.map +1 -0
- package/build/views/useSitemap.js +50 -0
- package/build/views/useSitemap.js.map +1 -0
- package/package.json +2 -2
- package/_async-server-import.js +0 -21
package/build/views/Sitemap.js
CHANGED
|
@@ -11,11 +11,8 @@ const react_1 = __importDefault(require("react"));
|
|
|
11
11
|
const react_native_1 = require("react-native");
|
|
12
12
|
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
13
13
|
const Pressable_1 = require("./Pressable");
|
|
14
|
-
const
|
|
15
|
-
const router_store_1 = require("../global-state/router-store");
|
|
16
|
-
const imperative_api_1 = require("../imperative-api");
|
|
14
|
+
const useSitemap_1 = require("./useSitemap");
|
|
17
15
|
const Link_1 = require("../link/Link");
|
|
18
|
-
const matchers_1 = require("../matchers");
|
|
19
16
|
const statusbar_1 = require("../utils/statusbar");
|
|
20
17
|
const INDENT = 20;
|
|
21
18
|
function getNavOptions() {
|
|
@@ -51,84 +48,63 @@ function getNavOptions() {
|
|
|
51
48
|
};
|
|
52
49
|
}
|
|
53
50
|
function Sitemap() {
|
|
51
|
+
const sitemap = (0, useSitemap_1.useSitemap)();
|
|
52
|
+
const children = react_1.default.useMemo(() => sitemap?.children.filter(({ isInternal }) => !isInternal) ?? [], [sitemap]);
|
|
54
53
|
return (<react_native_1.View style={styles.container}>
|
|
55
54
|
{statusbar_1.canOverrideStatusBarBehavior && <react_native_1.StatusBar barStyle="light-content"/>}
|
|
56
55
|
<react_native_1.ScrollView contentContainerStyle={styles.scroll}>
|
|
57
|
-
<
|
|
56
|
+
{children.map((child) => (<react_native_1.View testID="sitemap-item-container" key={child.contextKey} style={styles.itemContainer}>
|
|
57
|
+
<SitemapItem node={child}/>
|
|
58
|
+
</react_native_1.View>))}
|
|
58
59
|
</react_native_1.ScrollView>
|
|
59
60
|
</react_native_1.View>);
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
function SitemapItem({ node, level = 0 }) {
|
|
63
|
+
const isLayout = react_1.default.useMemo(() => node.children.length > 0 || node.contextKey.match(/_layout\.[jt]sx?$/), [node]);
|
|
64
|
+
const info = node.isInitial ? 'Initial' : node.isGenerated ? 'Generated' : '';
|
|
65
|
+
if (isLayout) {
|
|
66
|
+
return <LayoutSitemapItem node={node} level={level} info={info}/>;
|
|
67
|
+
}
|
|
68
|
+
return <StandardSitemapItem node={node} level={level} info={info}/>;
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
const
|
|
71
|
-
const segments = react_1.default.useMemo(() => [...parents, ...route.route.split('/')], [parents, route.route]);
|
|
72
|
-
const href = react_1.default.useMemo(() => {
|
|
73
|
-
return ('/' +
|
|
74
|
-
segments
|
|
75
|
-
.map((segment) => {
|
|
76
|
-
// add an extra layer of entropy to the url for deep dynamic routes
|
|
77
|
-
if ((0, matchers_1.matchDeepDynamicRouteName)(segment)) {
|
|
78
|
-
return segment + '/' + Date.now();
|
|
79
|
-
}
|
|
80
|
-
// index must be erased but groups can be preserved.
|
|
81
|
-
return segment === 'index' ? '' : segment;
|
|
82
|
-
})
|
|
83
|
-
.filter(Boolean)
|
|
84
|
-
.join('/'));
|
|
85
|
-
}, [segments, route.route]);
|
|
86
|
-
const filename = react_1.default.useMemo(() => {
|
|
87
|
-
const segments = route.contextKey.split('/');
|
|
88
|
-
// join last two segments for layout routes
|
|
89
|
-
if (route.contextKey.match(/_layout\.[jt]sx?$/)) {
|
|
90
|
-
return segments[segments.length - 2] + '/' + segments[segments.length - 1];
|
|
91
|
-
}
|
|
92
|
-
const routeSegmentsCount = route.route.split('/').length;
|
|
93
|
-
// Join the segment count in reverse order
|
|
94
|
-
// This presents files without layout routes as children with all relevant segments.
|
|
95
|
-
return segments.slice(-routeSegmentsCount).join('/');
|
|
96
|
-
}, [route]);
|
|
97
|
-
const info = isInitial ? 'Initial' : route.generated ? 'Virtual' : '';
|
|
70
|
+
function LayoutSitemapItem({ node, level, info }) {
|
|
71
|
+
const [isCollapsed, setIsCollapsed] = react_1.default.useState(true);
|
|
98
72
|
return (<>
|
|
99
|
-
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
imperative_api_1.router.back();
|
|
103
|
-
}
|
|
104
|
-
}} disabled={disabled} asChild
|
|
105
|
-
// Ensure we replace the history so you can't go back to this page.
|
|
106
|
-
replace>
|
|
107
|
-
<Pressable_1.Pressable>
|
|
108
|
-
{({ pressed, hovered }) => (<react_native_1.View style={[
|
|
109
|
-
styles.itemPressable,
|
|
110
|
-
{
|
|
111
|
-
paddingLeft: INDENT + level * INDENT,
|
|
112
|
-
backgroundColor: hovered ? '#202425' : 'transparent',
|
|
113
|
-
},
|
|
114
|
-
pressed && { backgroundColor: '#26292b' },
|
|
115
|
-
disabled && { opacity: 0.4 },
|
|
116
|
-
]}>
|
|
117
|
-
<react_native_1.View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
118
|
-
{route.children.length ? <PkgIcon /> : <FileIcon />}
|
|
119
|
-
<react_native_1.Text style={styles.filename}>{filename}</react_native_1.Text>
|
|
120
|
-
</react_native_1.View>
|
|
121
|
-
|
|
122
|
-
<react_native_1.View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
123
|
-
{!!info && (<react_native_1.Text style={[styles.virtual, !disabled && { marginRight: 8 }]}>{info}</react_native_1.Text>)}
|
|
124
|
-
{!disabled && <ForwardIcon />}
|
|
125
|
-
</react_native_1.View>
|
|
126
|
-
</react_native_1.View>)}
|
|
127
|
-
</Pressable_1.Pressable>
|
|
128
|
-
</Link_1.Link>)}
|
|
129
|
-
{route.children.map((child) => (<FileItem key={child.contextKey} route={child} isInitial={route.initialRouteName === child.route} parents={segments} level={level + (route.generated ? 0 : 1)}/>))}
|
|
73
|
+
<SitemapItemPressable style={{ opacity: 0.4 }} leftIcon={<PkgIcon />} rightIcon={<ArrowIcon rotation={isCollapsed ? 0 : 180}/>} filename={node.filename} level={level} info={info} onPress={() => setIsCollapsed((prev) => !prev)}/>
|
|
74
|
+
{!isCollapsed &&
|
|
75
|
+
node.children.map((child) => (<SitemapItem key={child.contextKey} node={child} level={level + (node.isGenerated ? 0 : 1)}/>))}
|
|
130
76
|
</>);
|
|
131
77
|
}
|
|
78
|
+
function StandardSitemapItem({ node, info, level }) {
|
|
79
|
+
return (<Link_1.Link accessibilityLabel={node.contextKey} href={node.href} asChild
|
|
80
|
+
// Ensure we replace the history so you can't go back to this page.
|
|
81
|
+
replace>
|
|
82
|
+
<SitemapItemPressable leftIcon={<FileIcon />} rightIcon={<ForwardIcon />} filename={node.filename} level={level} info={info}/>
|
|
83
|
+
</Link_1.Link>);
|
|
84
|
+
}
|
|
85
|
+
function SitemapItemPressable({ style, leftIcon, rightIcon, filename, level, info, ...pressableProps }) {
|
|
86
|
+
return (<Pressable_1.Pressable {...pressableProps}>
|
|
87
|
+
{({ pressed, hovered }) => (<react_native_1.View testID="sitemap-item" style={[
|
|
88
|
+
styles.itemPressable,
|
|
89
|
+
{
|
|
90
|
+
paddingLeft: INDENT + level * INDENT,
|
|
91
|
+
backgroundColor: hovered ? '#202425' : 'transparent',
|
|
92
|
+
},
|
|
93
|
+
pressed && { backgroundColor: '#26292b' },
|
|
94
|
+
style,
|
|
95
|
+
]}>
|
|
96
|
+
<react_native_1.View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
97
|
+
{leftIcon}
|
|
98
|
+
<react_native_1.Text style={styles.filename}>{filename}</react_native_1.Text>
|
|
99
|
+
</react_native_1.View>
|
|
100
|
+
|
|
101
|
+
<react_native_1.View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
102
|
+
{!!info && <react_native_1.Text style={[styles.virtual, { marginRight: 8 }]}>{info}</react_native_1.Text>}
|
|
103
|
+
{rightIcon}
|
|
104
|
+
</react_native_1.View>
|
|
105
|
+
</react_native_1.View>)}
|
|
106
|
+
</Pressable_1.Pressable>);
|
|
107
|
+
}
|
|
132
108
|
function FileIcon() {
|
|
133
109
|
return <react_native_1.Image style={styles.image} source={require('expo-router/assets/file.png')}/>;
|
|
134
110
|
}
|
|
@@ -141,6 +117,14 @@ function ForwardIcon() {
|
|
|
141
117
|
function SitemapIcon() {
|
|
142
118
|
return <react_native_1.Image style={styles.image} source={require('expo-router/assets/sitemap.png')}/>;
|
|
143
119
|
}
|
|
120
|
+
function ArrowIcon({ rotation = 0 }) {
|
|
121
|
+
return (<react_native_1.Image style={[
|
|
122
|
+
styles.image,
|
|
123
|
+
{
|
|
124
|
+
transform: [{ rotate: `${rotation}deg` }],
|
|
125
|
+
},
|
|
126
|
+
]} source={require('expo-router/assets/arrow_down.png')}/>);
|
|
127
|
+
}
|
|
144
128
|
const styles = react_native_1.StyleSheet.create({
|
|
145
129
|
container: {
|
|
146
130
|
backgroundColor: 'black',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sitemap.js","sourceRoot":"","sources":["../../src/views/Sitemap.tsx"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,YAAY,CAAC;;;;;AAiBb,sCAiCC;AAED,0BASC;AA1DD,kDAA0B;AAC1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Y,EAAE,CAAC;QACf,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;CACF,CAAC,CAAC","sourcesContent":["// Copyright © 2024 650 Industries.\n'use client';\n\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack';\nimport React from 'react';\nimport { Image, StyleSheet, Text, View, ScrollView, Platform, StatusBar } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { Pressable } from './Pressable';\nimport { RouteNode, sortRoutes } from '../Route';\nimport { store } from '../global-state/router-store';\nimport { router } from '../imperative-api';\nimport { Link } from '../link/Link';\nimport { matchDeepDynamicRouteName } from '../matchers';\nimport { canOverrideStatusBarBehavior } from '../utils/statusbar';\n\nconst INDENT = 20;\n\nexport function getNavOptions(): NativeStackNavigationOptions {\n return {\n title: 'sitemap',\n presentation: 'modal',\n headerLargeTitle: false,\n headerTitleStyle: {\n color: 'white',\n },\n headerTintColor: 'white',\n headerLargeTitleStyle: {\n color: 'white',\n },\n headerStyle: {\n backgroundColor: 'black',\n // @ts-expect-error: mistyped\n borderBottomColor: '#323232',\n },\n header: () => {\n const WrapperElement = Platform.OS === 'android' ? SafeAreaView : View;\n return (\n <WrapperElement style={styles.header}>\n <View style={styles.headerContent}>\n <View style={styles.headerIcon}>\n <SitemapIcon />\n </View>\n <Text role=\"heading\" aria-level={1} style={styles.title}>\n Sitemap\n </Text>\n </View>\n </WrapperElement>\n );\n },\n };\n}\n\nexport function Sitemap() {\n return (\n <View style={styles.container}>\n {canOverrideStatusBarBehavior && <StatusBar barStyle=\"light-content\" />}\n <ScrollView contentContainerStyle={styles.scroll}>\n <FileSystemView />\n </ScrollView>\n </View>\n );\n}\n\nfunction FileSystemView() {\n // This shouldn't occur, as the user should be on the tutorial screen\n if (!store.routeNode) return null;\n\n return store.routeNode.children.sort(sortRoutes).map((route) => (\n <View key={route.contextKey} style={styles.itemContainer}>\n <FileItem route={route} />\n </View>\n ));\n}\n\nfunction FileItem({\n route,\n level = 0,\n parents = [],\n isInitial = false,\n}: {\n route: RouteNode;\n level?: number;\n parents?: string[];\n isInitial?: boolean;\n}) {\n const disabled = route.children.length > 0;\n\n const segments = React.useMemo(\n () => [...parents, ...route.route.split('/')],\n [parents, route.route]\n );\n\n const href = React.useMemo(() => {\n return (\n '/' +\n segments\n .map((segment) => {\n // add an extra layer of entropy to the url for deep dynamic routes\n if (matchDeepDynamicRouteName(segment)) {\n return segment + '/' + Date.now();\n }\n // index must be erased but groups can be preserved.\n return segment === 'index' ? '' : segment;\n })\n .filter(Boolean)\n .join('/')\n );\n }, [segments, route.route]);\n\n const filename = React.useMemo(() => {\n const segments = route.contextKey.split('/');\n // join last two segments for layout routes\n if (route.contextKey.match(/_layout\\.[jt]sx?$/)) {\n return segments[segments.length - 2] + '/' + segments[segments.length - 1];\n }\n\n const routeSegmentsCount = route.route.split('/').length;\n\n // Join the segment count in reverse order\n // This presents files without layout routes as children with all relevant segments.\n return segments.slice(-routeSegmentsCount).join('/');\n }, [route]);\n\n const info = isInitial ? 'Initial' : route.generated ? 'Virtual' : '';\n\n return (\n <>\n {!route.internal && (\n <Link\n accessibilityLabel={route.contextKey}\n href={href}\n onPress={() => {\n if (Platform.OS !== 'web' && router.canGoBack()) {\n // Ensure the modal pops\n router.back();\n }\n }}\n disabled={disabled}\n asChild\n // Ensure we replace the history so you can't go back to this page.\n replace>\n <Pressable>\n {({ pressed, hovered }) => (\n <View\n style={[\n styles.itemPressable,\n {\n paddingLeft: INDENT + level * INDENT,\n backgroundColor: hovered ? '#202425' : 'transparent',\n },\n pressed && { backgroundColor: '#26292b' },\n disabled && { opacity: 0.4 },\n ]}>\n <View style={{ flexDirection: 'row', alignItems: 'center' }}>\n {route.children.length ? <PkgIcon /> : <FileIcon />}\n <Text style={styles.filename}>{filename}</Text>\n </View>\n\n <View style={{ flexDirection: 'row', alignItems: 'center' }}>\n {!!info && (\n <Text style={[styles.virtual, !disabled && { marginRight: 8 }]}>{info}</Text>\n )}\n {!disabled && <ForwardIcon />}\n </View>\n </View>\n )}\n </Pressable>\n </Link>\n )}\n {route.children.map((child) => (\n <FileItem\n key={child.contextKey}\n route={child}\n isInitial={route.initialRouteName === child.route}\n parents={segments}\n level={level + (route.generated ? 0 : 1)}\n />\n ))}\n </>\n );\n}\n\nfunction FileIcon() {\n return <Image style={styles.image} source={require('expo-router/assets/file.png')} />;\n}\n\nfunction PkgIcon() {\n return <Image style={styles.image} source={require('expo-router/assets/pkg.png')} />;\n}\n\nfunction ForwardIcon() {\n return <Image style={styles.image} source={require('expo-router/assets/forward.png')} />;\n}\n\nfunction SitemapIcon() {\n return <Image style={styles.image} source={require('expo-router/assets/sitemap.png')} />;\n}\n\nconst styles = StyleSheet.create({\n container: {\n backgroundColor: 'black',\n flex: 1,\n alignItems: 'stretch',\n },\n header: {\n backgroundColor: '#151718',\n paddingVertical: 16,\n borderBottomWidth: 1,\n borderColor: '#313538',\n shadowColor: '#000',\n shadowOffset: {\n width: 0,\n height: 3,\n },\n shadowOpacity: 0.33,\n shadowRadius: 3,\n elevation: 8,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 14,\n paddingHorizontal: '5%',\n ...Platform.select({\n web: {\n width: '100%',\n maxWidth: 960,\n marginHorizontal: 'auto',\n },\n }),\n },\n title: {\n color: 'white',\n fontSize: 28,\n fontWeight: 'bold',\n },\n scroll: {\n paddingHorizontal: '5%',\n paddingVertical: 16,\n ...Platform.select({\n ios: {\n paddingBottom: 24,\n },\n web: {\n width: '100%',\n maxWidth: 960,\n marginHorizontal: 'auto',\n paddingBottom: 24,\n },\n default: {\n paddingBottom: 12,\n },\n }),\n },\n itemContainer: {\n borderWidth: 1,\n borderColor: '#313538',\n backgroundColor: '#151718',\n borderRadius: 12,\n marginBottom: 12,\n overflow: 'hidden',\n },\n itemPressable: {\n paddingHorizontal: INDENT,\n paddingVertical: 16,\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n ...Platform.select({\n web: {\n transitionDuration: '100ms',\n },\n }),\n },\n filename: { color: 'white', fontSize: 20, marginLeft: 12 },\n virtual: { textAlign: 'right', color: 'white' },\n image: { width: 24, height: 24, resizeMode: 'contain', opacity: 0.6 },\n headerIcon: {\n width: 40,\n height: 40,\n backgroundColor: '#202425',\n borderRadius: 8,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"Sitemap.js","sourceRoot":"","sources":["../../src/views/Sitemap.tsx"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,YAAY,CAAC;;;;;AAuBb,sCAiCC;AAED,0BAkBC;AAzED,kDAA0B;AAC1B,+CASsB;AACtB,mFAA8D;AAE9D,2CAAwD;AACxD,6CAAuD;AACvD,uCAAoC;AACpC,kDAAkE;AAElE,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB,SAAgB,aAAa;IAC3B,OAAO;QACL,KAAK,EAAE,SAAS;QAChB,YAAY,EAAE,OAAO;QACrB,gBAAgB,EAAE,KAAK;QACvB,gBAAgB,EAAE;YAChB,KAAK,EAAE,OAAO;SACf;QACD,eAAe,EAAE,OAAO;QACxB,qBAAqB,EAAE;YACrB,KAAK,EAAE,OAAO;SACf;QACD,WAAW,EAAE;YACX,eAAe,EAAE,OAAO;YACxB,6BAA6B;YAC7B,iBAAiB,EAAE,SAAS;SAC7B;QACD,MAAM,EAAE,GAAG,EAAE;YACX,MAAM,cAAc,GAAG,uBAAQ,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,6CAAY,CAAC,CAAC,CAAC,mBAAI,CAAC;YACvE,OAAO,CACL,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CACnC;UAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAChC;YAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAC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;gBACH,kBAAkB,EAAE,OAAO;aAC5B;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;IAC1D,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IAC/C,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE;IACrE,UAAU,EAAE;QACV,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,eAAe,EAAE,SAAS;QAC1B,YAAY,EAAE,CAAC;QACf,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;CACF,CAAC,CAAC","sourcesContent":["// Copyright © 2024 650 Industries.\n'use client';\n\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack';\nimport React from 'react';\nimport {\n Image,\n StyleSheet,\n Text,\n View,\n ScrollView,\n Platform,\n StatusBar,\n ViewStyle,\n} from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { Pressable, PressableProps } from './Pressable';\nimport { useSitemap, SitemapType } from './useSitemap';\nimport { Link } from '../link/Link';\nimport { canOverrideStatusBarBehavior } from '../utils/statusbar';\n\nconst INDENT = 20;\n\nexport function getNavOptions(): NativeStackNavigationOptions {\n return {\n title: 'sitemap',\n presentation: 'modal',\n headerLargeTitle: false,\n headerTitleStyle: {\n color: 'white',\n },\n headerTintColor: 'white',\n headerLargeTitleStyle: {\n color: 'white',\n },\n headerStyle: {\n backgroundColor: 'black',\n // @ts-expect-error: mistyped\n borderBottomColor: '#323232',\n },\n header: () => {\n const WrapperElement = Platform.OS === 'android' ? SafeAreaView : View;\n return (\n <WrapperElement style={styles.header}>\n <View style={styles.headerContent}>\n <View style={styles.headerIcon}>\n <SitemapIcon />\n </View>\n <Text role=\"heading\" aria-level={1} style={styles.title}>\n Sitemap\n </Text>\n </View>\n </WrapperElement>\n );\n },\n };\n}\n\nexport function Sitemap() {\n const sitemap = useSitemap();\n const children = React.useMemo(\n () => sitemap?.children.filter(({ isInternal }) => !isInternal) ?? [],\n [sitemap]\n );\n return (\n <View style={styles.container}>\n {canOverrideStatusBarBehavior && <StatusBar barStyle=\"light-content\" />}\n <ScrollView contentContainerStyle={styles.scroll}>\n {children.map((child) => (\n <View testID=\"sitemap-item-container\" key={child.contextKey} style={styles.itemContainer}>\n <SitemapItem node={child} />\n </View>\n ))}\n </ScrollView>\n </View>\n );\n}\n\ninterface SitemapItemProps {\n node: SitemapType;\n level?: number;\n info?: string;\n}\n\nfunction SitemapItem({ node, level = 0 }: SitemapItemProps) {\n const isLayout = React.useMemo(\n () => node.children.length > 0 || node.contextKey.match(/_layout\\.[jt]sx?$/),\n [node]\n );\n const info = node.isInitial ? 'Initial' : node.isGenerated ? 'Generated' : '';\n\n if (isLayout) {\n return <LayoutSitemapItem node={node} level={level} info={info} />;\n }\n return <StandardSitemapItem node={node} level={level} info={info} />;\n}\nfunction LayoutSitemapItem({ node, level, info }: Required<SitemapItemProps>) {\n const [isCollapsed, setIsCollapsed] = React.useState(true);\n\n return (\n <>\n <SitemapItemPressable\n style={{ opacity: 0.4 }}\n leftIcon={<PkgIcon />}\n rightIcon={<ArrowIcon rotation={isCollapsed ? 0 : 180} />}\n filename={node.filename}\n level={level}\n info={info}\n onPress={() => setIsCollapsed((prev) => !prev)}\n />\n {!isCollapsed &&\n node.children.map((child) => (\n <SitemapItem\n key={child.contextKey}\n node={child}\n level={level + (node.isGenerated ? 0 : 1)}\n />\n ))}\n </>\n );\n}\n\nfunction StandardSitemapItem({ node, info, level }: Required<SitemapItemProps>) {\n return (\n <Link\n accessibilityLabel={node.contextKey}\n href={node.href}\n asChild\n // Ensure we replace the history so you can't go back to this page.\n replace>\n <SitemapItemPressable\n leftIcon={<FileIcon />}\n rightIcon={<ForwardIcon />}\n filename={node.filename}\n level={level}\n info={info}\n />\n </Link>\n );\n}\n\nfunction SitemapItemPressable({\n style,\n leftIcon,\n rightIcon,\n filename,\n level,\n info,\n ...pressableProps\n}: {\n style?: ViewStyle;\n leftIcon?: React.ReactNode;\n rightIcon?: React.ReactNode;\n filename: string;\n level: number;\n info?: string;\n} & Omit<PressableProps, 'style' | 'children'>) {\n return (\n <Pressable {...pressableProps}>\n {({ pressed, hovered }) => (\n <View\n testID=\"sitemap-item\"\n style={[\n styles.itemPressable,\n {\n paddingLeft: INDENT + level * INDENT,\n backgroundColor: hovered ? '#202425' : 'transparent',\n },\n pressed && { backgroundColor: '#26292b' },\n style,\n ]}>\n <View style={{ flexDirection: 'row', alignItems: 'center' }}>\n {leftIcon}\n <Text style={styles.filename}>{filename}</Text>\n </View>\n\n <View style={{ flexDirection: 'row', alignItems: 'center' }}>\n {!!info && <Text style={[styles.virtual, { marginRight: 8 }]}>{info}</Text>}\n {rightIcon}\n </View>\n </View>\n )}\n </Pressable>\n );\n}\n\nfunction FileIcon() {\n return <Image style={styles.image} source={require('expo-router/assets/file.png')} />;\n}\n\nfunction PkgIcon() {\n return <Image style={styles.image} source={require('expo-router/assets/pkg.png')} />;\n}\n\nfunction ForwardIcon() {\n return <Image style={styles.image} source={require('expo-router/assets/forward.png')} />;\n}\n\nfunction SitemapIcon() {\n return <Image style={styles.image} source={require('expo-router/assets/sitemap.png')} />;\n}\n\nfunction ArrowIcon({ rotation = 0 }: { rotation?: number }) {\n return (\n <Image\n style={[\n styles.image,\n {\n transform: [{ rotate: `${rotation}deg` }],\n },\n ]}\n source={require('expo-router/assets/arrow_down.png')}\n />\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n backgroundColor: 'black',\n flex: 1,\n alignItems: 'stretch',\n },\n header: {\n backgroundColor: '#151718',\n paddingVertical: 16,\n borderBottomWidth: 1,\n borderColor: '#313538',\n shadowColor: '#000',\n shadowOffset: {\n width: 0,\n height: 3,\n },\n shadowOpacity: 0.33,\n shadowRadius: 3,\n elevation: 8,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 14,\n paddingHorizontal: '5%',\n ...Platform.select({\n web: {\n width: '100%',\n maxWidth: 960,\n marginHorizontal: 'auto',\n },\n }),\n },\n title: {\n color: 'white',\n fontSize: 28,\n fontWeight: 'bold',\n },\n scroll: {\n paddingHorizontal: '5%',\n paddingVertical: 16,\n ...Platform.select({\n ios: {\n paddingBottom: 24,\n },\n web: {\n width: '100%',\n maxWidth: 960,\n marginHorizontal: 'auto',\n paddingBottom: 24,\n },\n default: {\n paddingBottom: 12,\n },\n }),\n },\n itemContainer: {\n borderWidth: 1,\n borderColor: '#313538',\n backgroundColor: '#151718',\n borderRadius: 12,\n marginBottom: 12,\n overflow: 'hidden',\n },\n itemPressable: {\n paddingHorizontal: INDENT,\n paddingVertical: 16,\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n ...Platform.select({\n web: {\n transitionDuration: '100ms',\n },\n }),\n },\n filename: { color: 'white', fontSize: 20, marginLeft: 12 },\n virtual: { textAlign: 'right', color: 'white' },\n image: { width: 24, height: 24, resizeMode: 'contain', opacity: 0.6 },\n headerIcon: {\n width: 40,\n height: 40,\n backgroundColor: '#202425',\n borderRadius: 8,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Href } from '../types';
|
|
2
|
+
export type SitemapType = {
|
|
3
|
+
contextKey: string;
|
|
4
|
+
filename: string;
|
|
5
|
+
href: string | Href;
|
|
6
|
+
isInitial: boolean;
|
|
7
|
+
isInternal: boolean;
|
|
8
|
+
isGenerated: boolean;
|
|
9
|
+
children: SitemapType[];
|
|
10
|
+
};
|
|
11
|
+
export declare function useSitemap(): SitemapType | null;
|
|
12
|
+
//# sourceMappingURL=useSitemap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSitemap.d.ts","sourceRoot":"","sources":["../../src/views/useSitemap.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAmChC,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB,CAAC;AAcF,wBAAgB,UAAU,IAAI,WAAW,GAAG,IAAI,CAM/C"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSitemap = useSitemap;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const Route_1 = require("../Route");
|
|
6
|
+
const router_store_1 = require("../global-state/router-store");
|
|
7
|
+
const matchers_1 = require("../matchers");
|
|
8
|
+
const routeSegments = (route, parents) => [
|
|
9
|
+
...parents,
|
|
10
|
+
...route.route.split('/'),
|
|
11
|
+
];
|
|
12
|
+
const routeHref = (route, parents) => '/' +
|
|
13
|
+
routeSegments(route, parents)
|
|
14
|
+
.map((segment) => {
|
|
15
|
+
// add an extra layer of entropy to the url for deep dynamic routes
|
|
16
|
+
if ((0, matchers_1.matchDynamicName)(segment)?.deep) {
|
|
17
|
+
return segment + '/' + Date.now();
|
|
18
|
+
}
|
|
19
|
+
// index must be erased but groups can be preserved.
|
|
20
|
+
return segment === 'index' ? '' : segment;
|
|
21
|
+
})
|
|
22
|
+
.filter(Boolean)
|
|
23
|
+
.join('/');
|
|
24
|
+
const routeFilename = (route) => {
|
|
25
|
+
const segments = route.contextKey.split('/');
|
|
26
|
+
// join last two segments for layout routes
|
|
27
|
+
if (route.contextKey.match(/_layout\.[jt]sx?$/)) {
|
|
28
|
+
return segments[segments.length - 2] + '/' + segments[segments.length - 1];
|
|
29
|
+
}
|
|
30
|
+
const routeSegmentsCount = route.route.split('/').length;
|
|
31
|
+
// Join the segment count in reverse order
|
|
32
|
+
// This presents files without layout routes as children with all relevant segments.
|
|
33
|
+
return segments.slice(-routeSegmentsCount).join('/');
|
|
34
|
+
};
|
|
35
|
+
const mapForRoute = (route, parents) => ({
|
|
36
|
+
contextKey: route.contextKey,
|
|
37
|
+
filename: routeFilename(route),
|
|
38
|
+
href: routeHref(route, parents),
|
|
39
|
+
isInitial: route.initialRouteName === route.route,
|
|
40
|
+
isInternal: route.internal ?? false,
|
|
41
|
+
isGenerated: route.generated ?? false,
|
|
42
|
+
children: [...route.children]
|
|
43
|
+
.sort(Route_1.sortRoutes)
|
|
44
|
+
.map((child) => mapForRoute(child, routeSegments(route, parents))),
|
|
45
|
+
});
|
|
46
|
+
function useSitemap() {
|
|
47
|
+
const sitemap = (0, react_1.useMemo)(() => (router_store_1.store.routeNode ? mapForRoute(router_store_1.store.routeNode, []) : null), [router_store_1.store.routeNode]);
|
|
48
|
+
return sitemap;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=useSitemap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSitemap.js","sourceRoot":"","sources":["../../src/views/useSitemap.tsx"],"names":[],"mappings":";;AA8DA,gCAMC;AApED,iCAAgC;AAEhC,oCAAiD;AACjD,+DAAqD;AACrD,0CAA+C;AAG/C,MAAM,aAAa,GAAG,CAAC,KAAgB,EAAE,OAAiB,EAAE,EAAE,CAAC;IAC7D,GAAG,OAAO;IACV,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;CAC1B,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAgB,EAAE,OAAiB,EAAE,EAAE,CACxD,GAAG;IACH,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC;SAC1B,GAAG,C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AAK,CAAC,KAAK;IACjD,UAAU,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK;IACnC,WAAW,EAAE,KAAK,CAAC,SAAS,IAAI,KAAK;IACrC,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;SAC1B,IAAI,CAAC,kBAAU,CAAC;SAChB,GAAG,CAAC,CAAC,KAAgB,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;CAChF,CAAC,CAAC;AAEH,SAAgB,UAAU;IACxB,MAAM,OAAO,GAAG,IAAA,eAAO,EACrB,GAAG,EAAE,CAAC,CAAC,oBAAK,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,oBAAK,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EACjE,CAAC,oBAAK,CAAC,SAAS,CAAC,CAClB,CAAC;IACF,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { useMemo } from 'react';\n\nimport { RouteNode, sortRoutes } from '../Route';\nimport { store } from '../global-state/router-store';\nimport { matchDynamicName } from '../matchers';\nimport { Href } from '../types';\n\nconst routeSegments = (route: RouteNode, parents: string[]) => [\n ...parents,\n ...route.route.split('/'),\n];\n\nconst routeHref = (route: RouteNode, parents: string[]) =>\n '/' +\n routeSegments(route, parents)\n .map((segment) => {\n // add an extra layer of entropy to the url for deep dynamic routes\n if (matchDynamicName(segment)?.deep) {\n return segment + '/' + Date.now();\n }\n // index must be erased but groups can be preserved.\n return segment === 'index' ? '' : segment;\n })\n .filter(Boolean)\n .join('/');\n\nconst routeFilename = (route: RouteNode) => {\n const segments = route.contextKey.split('/');\n // join last two segments for layout routes\n if (route.contextKey.match(/_layout\\.[jt]sx?$/)) {\n return segments[segments.length - 2] + '/' + segments[segments.length - 1];\n }\n\n const routeSegmentsCount = route.route.split('/').length;\n\n // Join the segment count in reverse order\n // This presents files without layout routes as children with all relevant segments.\n return segments.slice(-routeSegmentsCount).join('/');\n};\n\nexport type SitemapType = {\n contextKey: string;\n filename: string;\n href: string | Href;\n isInitial: boolean;\n isInternal: boolean;\n isGenerated: boolean;\n children: SitemapType[];\n};\n\nconst mapForRoute: (route: RouteNode, parents: string[]) => SitemapType = (route, parents) => ({\n contextKey: route.contextKey,\n filename: routeFilename(route),\n href: routeHref(route, parents),\n isInitial: route.initialRouteName === route.route,\n isInternal: route.internal ?? false,\n isGenerated: route.generated ?? false,\n children: [...route.children]\n .sort(sortRoutes)\n .map((child: RouteNode) => mapForRoute(child, routeSegments(route, parents))),\n});\n\nexport function useSitemap(): SitemapType | null {\n const sitemap = useMemo(\n () => (store.routeNode ? mapForRoute(store.routeNode, []) : null),\n [store.routeNode]\n );\n return sitemap;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Expo Router is a file-based router for React Native and web applications.",
|
|
5
5
|
"author": "650 Industries, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"server-only": "^0.0.1",
|
|
121
121
|
"shallowequal": "^1.1.0"
|
|
122
122
|
},
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "41c654c0318dfcc0d0f3a7a3b23ec498494542df"
|
|
124
124
|
}
|
package/_async-server-import.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Outside the build dir to preserve the import syntax.
|
|
2
|
-
export async function asyncServerImport(moduleId) {
|
|
3
|
-
// Not running in cloudflare, use Node.js require.
|
|
4
|
-
if (typeof caches === 'undefined') {
|
|
5
|
-
return $$require_external(moduleId);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
let mod = await import(/* @metro-ignore */ moduleId);
|
|
9
|
-
|
|
10
|
-
// Unwrap exported `{ default: <mod> }` objects, where `<mod>` is another default exported ESM module
|
|
11
|
-
if (
|
|
12
|
-
'default' in mod &&
|
|
13
|
-
typeof mod.default === 'object' &&
|
|
14
|
-
mod.default &&
|
|
15
|
-
(mod.default.default !== undefined || mod.default.__esModule === true)
|
|
16
|
-
) {
|
|
17
|
-
mod = mod.default;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return mod;
|
|
21
|
-
}
|