"use strict";
// Copyright © 2024 650 Industries.
'use client';
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNavOptions = getNavOptions;
exports.Sitemap = Sitemap;
const expo_constants_1 = __importDefault(require("expo-constants"));
const react_1 = __importDefault(require("react"));
const react_native_1 = require("react-native");
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
const NoSSR_1 = require("./NoSSR");
const Pressable_1 = require("./Pressable");
const useSitemap_1 = require("./useSitemap");
const Link_1 = require("../link/Link");
const statusbar_1 = require("../utils/statusbar");
const INDENT = 20;
function getNavOptions() {
return {
title: 'sitemap',
presentation: 'modal',
headerLargeTitle: false,
headerTitleStyle: {
color: 'white',
},
headerShown: true,
headerTintColor: 'white',
headerLargeTitleStyle: {
color: 'white',
},
headerStyle: {
backgroundColor: 'black',
// @ts-expect-error: mistyped
borderBottomColor: '#323232',
},
header: () => {
const WrapperElement = react_native_1.Platform.OS === 'android' ? react_native_safe_area_context_1.SafeAreaView : react_native_1.View;
return (
Sitemap
);
},
};
}
function Sitemap() {
// Following the https://github.com/expo/expo/blob/ubax/router/move-404-and-sitemap-to-root/packages/expo-router/src/getRoutesSSR.ts#L38
// we need to ensure that the Sitemap component is not rendered on the server.
return (
);
}
function SitemapInner() {
const sitemap = (0, useSitemap_1.useSitemap)();
const children = react_1.default.useMemo(() => sitemap?.children.filter(({ isInternal }) => !isInternal) ?? [], [sitemap]);
const Wrapper = react_native_1.Platform.OS === 'android' ? react_native_safe_area_context_1.SafeAreaView : react_native_1.View;
return (
{statusbar_1.canOverrideStatusBarBehavior && }
{children.map((child) => (
))}
);
}
function SitemapItem({ node, level = 0 }) {
const isLayout = react_1.default.useMemo(() => node.children.length > 0 || node.contextKey.match(/_layout\.[jt]sx?$/), [node]);
const info = node.isInitial ? 'Initial' : node.isGenerated ? 'Generated' : '';
if (isLayout) {
return ;
}
return ;
}
function LayoutSitemapItem({ node, level, info }) {
const [isCollapsed, setIsCollapsed] = react_1.default.useState(true);
return (
} rightIcon={} filename={node.filename} level={level} info={info} onPress={() => setIsCollapsed((prev) => !prev)}/>
{!isCollapsed &&
node.children.map((child) => ())}
);
}
function StandardSitemapItem({ node, info, level }) {
return (
} rightIcon={} filename={node.filename} level={level} info={info}/>
);
}
function SitemapItemPressable({ style, leftIcon, rightIcon, filename, level, info, ...pressableProps }) {
return (
{({ pressed, hovered }) => (
{leftIcon}
{filename}
{!!info && {info}}
{rightIcon}
)}
);
}
function FileIcon() {
return ;
}
function PkgIcon() {
return ;
}
function ForwardIcon() {
return ;
}
function SitemapIcon() {
return ;
}
function ArrowIcon({ rotation = 0 }) {
return ();
}
function SystemInfo() {
const getHermesVersion = () => {
if (!global.HermesInternal) {
return null;
}
const HERMES_RUNTIME = global.HermesInternal?.getRuntimeProperties?.() ?? {};
const HERMES_VERSION = HERMES_RUNTIME['OSS Release Version'];
const isStaticHermes = HERMES_RUNTIME['Static Hermes'];
if (!HERMES_RUNTIME) {
return null;
}
if (isStaticHermes) {
return `${HERMES_VERSION} (shermes)`;
}
return HERMES_VERSION;
};
const locationOrigin = window.location.origin;
const expoSdkVersion = expo_constants_1.default.expoConfig?.sdkVersion || 'Unknown';
const hermesVersion = getHermesVersion();
return (
System Information
Mode
Expo SDK
{hermesVersion && Hermes version}
{locationOrigin && Location origin}
);
}
function FormText({ children, right }) {
return (
{children}
{right}
);
}
const styles = react_native_1.StyleSheet.create({
container: {
backgroundColor: 'black',
flex: 1,
alignItems: 'stretch',
},
header: {
backgroundColor: '#151718',
paddingVertical: 16,
borderBottomWidth: 1,
borderColor: '#313538',
boxShadow: '0px 3px 3px rgba(0, 0, 0, 0.33)',
},
headerContent: {
flexDirection: 'row',
alignItems: 'center',
gap: 14,
paddingHorizontal: '5%',
...react_native_1.Platform.select({
web: {
width: '100%',
maxWidth: 960,
marginHorizontal: 'auto',
},
}),
},
title: {
color: 'white',
fontSize: 28,
fontWeight: 'bold',
},
scroll: {
gap: 12,
paddingHorizontal: '5%',
paddingVertical: 16,
...react_native_1.Platform.select({
ios: {
paddingBottom: 24,
},
web: {
width: '100%',
maxWidth: 960,
marginHorizontal: 'auto',
paddingBottom: 24,
},
default: {
paddingBottom: 12,
},
}),
},
itemContainer: {
borderWidth: 1,
borderColor: '#313538',
backgroundColor: '#151718',
borderRadius: 12,
borderCurve: 'continuous',
},
itemInnerContainer: {
backgroundColor: '#151718',
borderRadius: 12,
borderCurve: 'continuous',
gap: 12,
},
itemPressable: {
paddingHorizontal: INDENT,
paddingVertical: 16,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
...react_native_1.Platform.select({
web: {
transitionDuration: '100ms',
},
}),
},
filename: { color: 'white', fontSize: 20, marginLeft: 12 },
virtual: { textAlign: 'right', color: 'white' },
image: { width: 24, height: 24, resizeMode: 'contain', opacity: 0.6 },
headerIcon: {
width: 40,
height: 40,
backgroundColor: '#202425',
borderRadius: 8,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
},
systemInfoContainer: {
borderWidth: 1,
borderColor: '#313538',
backgroundColor: '#151718',
borderRadius: 12,
gap: 8,
borderCurve: 'continuous',
padding: INDENT,
},
systemInfoTitle: {
color: 'white',
fontSize: 18,
fontWeight: '600',
marginBottom: 12,
paddingHorizontal: INDENT,
},
systemInfoItem: {
flexDirection: 'row',
gap: 8,
alignItems: 'center',
flexWrap: 'wrap',
},
systemInfoLabel: {
color: 'white',
fontSize: 16,
lineHeight: 24,
},
systemInfoValue: {
color: 'white',
fontSize: 16,
opacity: 0.7,
flexShrink: 1,
letterSpacing: 0.5,
},
code: {
fontVariant: ['tabular-nums'],
fontFamily: react_native_1.Platform.select({
default: `SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,
ios: 'ui-monospace',
android: 'monospace',
}),
fontWeight: '500',
},
});
//# sourceMappingURL=Sitemap.js.map