@adminide-stack/yantra-mobile 12.0.140 → 12.0.141
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/lib/features/agent-chat/NativeAgentChat.js +21 -4
- package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
- package/lib/features/chat/ApprovalCard.js +353 -0
- package/lib/features/chat/ApprovalCard.js.map +1 -0
- package/lib/features/chat/AskUserCard.js +9 -2
- package/lib/features/chat/AskUserCard.js.map +1 -1
- package/lib/features/chat/askUser.js +25 -3
- package/lib/features/chat/askUser.js.map +1 -1
- package/lib/features/chat/queuedFollowUpRows.js +13 -0
- package/lib/features/chat/queuedFollowUpRows.js.map +1 -0
- package/lib/features/discover/DiscoverArticle.js +105 -92
- package/lib/features/discover/DiscoverArticle.js.map +1 -1
- package/lib/features/discover/DiscoverFeed.js +97 -48
- package/lib/features/discover/DiscoverFeed.js.map +1 -1
- package/lib/features/discover/DiscoverFollowUp.js +135 -0
- package/lib/features/discover/DiscoverFollowUp.js.map +1 -0
- package/lib/features/discover/DiscoverSidebar.js +555 -0
- package/lib/features/discover/DiscoverSidebar.js.map +1 -0
- package/lib/features/discover/DiscoverSkeletons.js +123 -0
- package/lib/features/discover/DiscoverSkeletons.js.map +1 -0
- package/lib/features/discover/DiscoverStoryCards.js +193 -87
- package/lib/features/discover/DiscoverStoryCards.js.map +1 -1
- package/lib/features/discover/followUpQuery.js +42 -0
- package/lib/features/discover/followUpQuery.js.map +1 -0
- package/lib/features/discover/markets.js +37 -0
- package/lib/features/discover/markets.js.map +1 -0
- package/lib/features/discover/useDiscoverSidebar.js +148 -0
- package/lib/features/discover/useDiscoverSidebar.js.map +1 -0
- package/lib/features/discover/weather.js +42 -0
- package/lib/features/discover/weather.js.map +1 -0
- package/lib/features/expenses/ExpensesAgentChatPane.js +1 -1
- package/lib/features/expenses/ExpensesAgentChatPane.js.map +1 -1
- package/lib/features/inbox/InboxAgentChatPane.js +1 -1
- package/lib/features/inbox/InboxAgentChatPane.js.map +1 -1
- package/lib/features/job-search/JobSearchAgentChatPane.js +1 -0
- package/lib/features/job-search/JobSearchAgentChatPane.js.map +1 -1
- package/lib/features/local-services/LocalServicesAgentChatPane.js +1 -1
- package/lib/features/local-services/LocalServicesAgentChatPane.js.map +1 -1
- package/lib/features/movies/MoviesAgentChatPane.js +1 -1
- package/lib/features/movies/MoviesAgentChatPane.js.map +1 -1
- package/lib/features/notion/NotionBlockSheets.js +206 -0
- package/lib/features/notion/NotionBlockSheets.js.map +1 -0
- package/lib/features/notion/NotionBlockView.js +36 -0
- package/lib/features/notion/NotionBlockView.js.map +1 -0
- package/lib/features/notion/NotionCommentsSheet.js +461 -0
- package/lib/features/notion/NotionCommentsSheet.js.map +1 -0
- package/lib/features/notion/NotionConnectionsSheet.js +244 -0
- package/lib/features/notion/NotionConnectionsSheet.js.map +1 -0
- package/lib/features/notion/NotionHistorySheet.js +439 -0
- package/lib/features/notion/NotionHistorySheet.js.map +1 -0
- package/lib/features/notion/NotionMediaBlocks.js +803 -0
- package/lib/features/notion/NotionMediaBlocks.js.map +1 -0
- package/lib/features/notion/NotionMentionSheet.js +279 -0
- package/lib/features/notion/NotionMentionSheet.js.map +1 -0
- package/lib/features/notion/NotionPageMenu.js +585 -0
- package/lib/features/notion/NotionPageMenu.js.map +1 -0
- package/lib/features/notion/NotionPageTree.js +220 -0
- package/lib/features/notion/NotionPageTree.js.map +1 -0
- package/lib/features/notion/NotionPageView.js +1253 -152
- package/lib/features/notion/NotionPageView.js.map +1 -1
- package/lib/features/notion/NotionShareSheet.js +606 -0
- package/lib/features/notion/NotionShareSheet.js.map +1 -0
- package/lib/features/notion/NotionSheets.js +87 -15
- package/lib/features/notion/NotionSheets.js.map +1 -1
- package/lib/features/notion/NotionSidebarSections.js +492 -0
- package/lib/features/notion/NotionSidebarSections.js.map +1 -0
- package/lib/features/notion/NotionWorkspaceAdmin.js +659 -0
- package/lib/features/notion/NotionWorkspaceAdmin.js.map +1 -0
- package/lib/features/notion/NotionWorkspaceView.js +257 -45
- package/lib/features/notion/NotionWorkspaceView.js.map +1 -1
- package/lib/features/notion/database/DatabaseCells.js +554 -0
- package/lib/features/notion/database/DatabaseCells.js.map +1 -0
- package/lib/features/notion/database/DatabaseDateLayouts.js +792 -0
- package/lib/features/notion/database/DatabaseDateLayouts.js.map +1 -0
- package/lib/features/notion/database/DatabaseLayouts.js +461 -0
- package/lib/features/notion/database/DatabaseLayouts.js.map +1 -0
- package/lib/features/notion/database/DatabaseSheets.js +791 -0
- package/lib/features/notion/database/DatabaseSheets.js.map +1 -0
- package/lib/features/notion/database/NotionDatabaseView.js +817 -0
- package/lib/features/notion/database/NotionDatabaseView.js.map +1 -0
- package/lib/features/notion/database/RowPropertiesPanel.js +162 -0
- package/lib/features/notion/database/RowPropertiesPanel.js.map +1 -0
- package/lib/features/notion/database/chartData.js +89 -0
- package/lib/features/notion/database/chartData.js.map +1 -0
- package/lib/features/notion/database/chartView.js +112 -0
- package/lib/features/notion/database/chartView.js.map +1 -0
- package/lib/features/notion/database/connectorButton.js +33 -0
- package/lib/features/notion/database/connectorButton.js.map +1 -0
- package/lib/features/notion/database/databaseCalc.js +208 -0
- package/lib/features/notion/database/databaseCalc.js.map +1 -0
- package/lib/features/notion/database/databaseCalendar.js +157 -0
- package/lib/features/notion/database/databaseCalendar.js.map +1 -0
- package/lib/features/notion/database/databaseCsv.js +98 -0
- package/lib/features/notion/database/databaseCsv.js.map +1 -0
- package/lib/features/notion/database/databaseCsvActions.js +58 -0
- package/lib/features/notion/database/databaseCsvActions.js.map +1 -0
- package/lib/features/notion/database/databaseFilter.js +473 -0
- package/lib/features/notion/database/databaseFilter.js.map +1 -0
- package/lib/features/notion/database/databaseFormula.js +1072 -0
- package/lib/features/notion/database/databaseFormula.js.map +1 -0
- package/lib/features/notion/database/databaseGroup.js +151 -0
- package/lib/features/notion/database/databaseGroup.js.map +1 -0
- package/lib/features/notion/database/databaseRollup.js +58 -0
- package/lib/features/notion/database/databaseRollup.js.map +1 -0
- package/lib/features/notion/database/databaseTimeline.js +156 -0
- package/lib/features/notion/database/databaseTimeline.js.map +1 -0
- package/lib/features/notion/database/databaseView.js +1188 -0
- package/lib/features/notion/database/databaseView.js.map +1 -0
- package/lib/features/notion/database/databaseViews.js +310 -0
- package/lib/features/notion/database/databaseViews.js.map +1 -0
- package/lib/features/notion/database/relationSource.js +92 -0
- package/lib/features/notion/database/relationSource.js.map +1 -0
- package/lib/features/notion/database/uniqueId.js +17 -0
- package/lib/features/notion/database/uniqueId.js.map +1 -0
- package/lib/features/notion/database/useNotionDatabase.js +617 -0
- package/lib/features/notion/database/useNotionDatabase.js.map +1 -0
- package/lib/features/notion/notionAgentRunStatus.js +39 -0
- package/lib/features/notion/notionAgentRunStatus.js.map +1 -0
- package/lib/features/notion/notionCodeLanguages.js +112 -0
- package/lib/features/notion/notionCodeLanguages.js.map +1 -0
- package/lib/features/notion/notionComments.js +86 -0
- package/lib/features/notion/notionComments.js.map +1 -0
- package/lib/features/notion/notionConnections.js +74 -0
- package/lib/features/notion/notionConnections.js.map +1 -0
- package/lib/features/notion/notionDocuments.js +453 -1
- package/lib/features/notion/notionDocuments.js.map +1 -1
- package/lib/features/notion/notionEditorModel.js +142 -7
- package/lib/features/notion/notionEditorModel.js.map +1 -1
- package/lib/features/notion/notionMarkdownShortcuts.js +51 -0
- package/lib/features/notion/notionMarkdownShortcuts.js.map +1 -0
- package/lib/features/notion/notionMedia.js +119 -0
- package/lib/features/notion/notionMedia.js.map +1 -0
- package/lib/features/notion/notionMentionDate.js +32 -0
- package/lib/features/notion/notionMentionDate.js.map +1 -0
- package/lib/features/notion/notionMentionOptions.js +162 -0
- package/lib/features/notion/notionMentionOptions.js.map +1 -0
- package/lib/features/notion/notionNotesAgent.js +445 -0
- package/lib/features/notion/notionNotesAgent.js.map +1 -0
- package/lib/features/notion/notionPageAccess.js +168 -0
- package/lib/features/notion/notionPageAccess.js.map +1 -0
- package/lib/features/notion/notionPageActions.js +138 -0
- package/lib/features/notion/notionPageActions.js.map +1 -0
- package/lib/features/notion/notionPageHistory.js +154 -0
- package/lib/features/notion/notionPageHistory.js.map +1 -0
- package/lib/features/notion/notionPageKinds.js +200 -0
- package/lib/features/notion/notionPageKinds.js.map +1 -0
- package/lib/features/notion/notionRecents.js +48 -0
- package/lib/features/notion/notionRecents.js.map +1 -0
- package/lib/features/notion/notionRichText.js +177 -0
- package/lib/features/notion/notionRichText.js.map +1 -0
- package/lib/features/notion/notionRichTitle.js +336 -0
- package/lib/features/notion/notionRichTitle.js.map +1 -0
- package/lib/features/notion/useNotionWorkspace.js +272 -13
- package/lib/features/notion/useNotionWorkspace.js.map +1 -1
- package/lib/features/notion/usePageActions.js +155 -0
- package/lib/features/notion/usePageActions.js.map +1 -0
- package/lib/features/resume/ResumeAgentChatPane.js +1 -1
- package/lib/features/resume/ResumeAgentChatPane.js.map +1 -1
- package/lib/features/shopping/ShoppingAgentChatPane.js +1 -1
- package/lib/features/shopping/ShoppingAgentChatPane.js.map +1 -1
- package/lib/features/study/StudyAgentChatPane.js +1 -1
- package/lib/features/study/StudyAgentChatPane.js.map +1 -1
- package/lib/features/travel/TravelAgentChatPane.js +1 -1
- package/lib/features/travel/TravelAgentChatPane.js.map +1 -1
- package/lib/features/webbuilder/WebBuilderExperience.js +40 -8
- package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
- package/lib/features/webbuilder/buildFragments.js +1 -1
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/codeFiles.js +302 -0
- package/lib/features/webbuilder/codeFiles.js.map +1 -0
- package/lib/features/webbuilder/codeHighlight.js +209 -0
- package/lib/features/webbuilder/codeHighlight.js.map +1 -0
- package/lib/features/webbuilder/components/CodeView.js +682 -52
- package/lib/features/webbuilder/components/CodeView.js.map +1 -1
- package/lib/features/webbuilder/components/PreviewScreen.js +59 -38
- package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
- package/lib/features/webbuilder/components/ProjectChat.js +3 -3
- package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
- package/lib/features/webbuilder/stepLabels.js +68 -0
- package/lib/features/webbuilder/stepLabels.js.map +1 -0
- package/lib/hooks/useHostChatSteering.js +45 -0
- package/lib/hooks/useHostChatSteering.js.map +1 -0
- package/lib/screens/Chat/index.js +2 -12
- package/lib/screens/Chat/index.js.map +1 -1
- package/lib/screens/ExpensesNative/useExpensesHostChat.js +25 -5
- package/lib/screens/ExpensesNative/useExpensesHostChat.js.map +1 -1
- package/lib/screens/InboxNative/useInboxHostChat.js +25 -5
- package/lib/screens/InboxNative/useInboxHostChat.js.map +1 -1
- package/lib/screens/JobSearchNative/useJobSearchHostChat.js +25 -5
- package/lib/screens/JobSearchNative/useJobSearchHostChat.js.map +1 -1
- package/lib/screens/LocalServicesNative/useLocalServicesHostChat.js +25 -5
- package/lib/screens/LocalServicesNative/useLocalServicesHostChat.js.map +1 -1
- package/lib/screens/MoviesNative/useMoviesHostChat.js +25 -5
- package/lib/screens/MoviesNative/useMoviesHostChat.js.map +1 -1
- package/lib/screens/NotionPage/index.js +2 -2
- package/lib/screens/NotionPage/index.js.map +1 -1
- package/lib/screens/ResumeNative/useResumeHostChat.js +25 -5
- package/lib/screens/ResumeNative/useResumeHostChat.js.map +1 -1
- package/lib/screens/ShoppingNative/useShoppingHostChat.js +25 -5
- package/lib/screens/ShoppingNative/useShoppingHostChat.js.map +1 -1
- package/lib/screens/StudyNative/useStudyHostChat.js +25 -5
- package/lib/screens/StudyNative/useStudyHostChat.js.map +1 -1
- package/lib/screens/TravelNative/useTravelHostChat.js +25 -5
- package/lib/screens/TravelNative/useTravelHostChat.js.map +1 -1
- package/lib/screens/WebBuilderNative/codeWorkspaceApi.js +222 -0
- package/lib/screens/WebBuilderNative/codeWorkspaceApi.js.map +1 -0
- package/lib/screens/WebBuilderNative/index.js +1 -1
- package/lib/screens/WebBuilderNative/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/sandboxProxyApi.js +126 -4
- package/lib/screens/WebBuilderNative/sandboxProxyApi.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +120 -11
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,9 +1,43 @@
|
|
|
1
|
-
import {jsx,jsxs}from'react/jsx-runtime';import {
|
|
1
|
+
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useState,useCallback,useEffect,useMemo,useRef}from'react';import {Platform,StyleSheet,View,Text,TextInput,ActivityIndicator,ScrollView,FlatList,Alert}from'react-native';import {MaterialCommunityIcons}from'@expo/vector-icons';import {Tap,DIM}from'../../inbox/components/Tap.js';import {preferredFile,matchFileNames,sortTree,normalizeQuery}from'../codeFiles.js';import {CenteredState}from'./ui.js';import {highlightLines,codeLanguage,tokenColors}from'../codeHighlight.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __restKey = (key) => typeof key === "symbol" ? key : key + "";
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
const MAX_HIGHLIGHT_CHARS = 2e5;
|
|
2
34
|
const MONO = Platform.select({
|
|
3
35
|
ios: "Menlo",
|
|
4
36
|
android: "monospace",
|
|
5
37
|
default: "monospace"
|
|
6
38
|
});
|
|
39
|
+
const LINE_HEIGHT = 18;
|
|
40
|
+
const MAX_FALLBACK_CHARS = 6e4;
|
|
7
41
|
function orderedFiles(files) {
|
|
8
42
|
const rank = (path) => {
|
|
9
43
|
if (/(^|\/)src\//.test(path) || /(^|\/)(app|pages|components)\//.test(path)) return 0;
|
|
@@ -12,7 +46,82 @@ function orderedFiles(files) {
|
|
|
12
46
|
};
|
|
13
47
|
return Object.keys(files).filter((path) => !/(^|\/)(package-lock\.json|yarn\.lock|pnpm-lock\.yaml)$/.test(path)).sort((a, b) => rank(a) - rank(b) || a.localeCompare(b));
|
|
14
48
|
}
|
|
15
|
-
function
|
|
49
|
+
function treeRows(files, collapsed) {
|
|
50
|
+
const rows = [];
|
|
51
|
+
const seenDirs = /* @__PURE__ */ new Set();
|
|
52
|
+
for (const path of sortTree(files)) {
|
|
53
|
+
const parts = path.split("/");
|
|
54
|
+
let hidden = false;
|
|
55
|
+
for (let i = 0; i < parts.length - 1 && !hidden; i += 1) {
|
|
56
|
+
const dir = parts.slice(0, i + 1).join("/");
|
|
57
|
+
if (!seenDirs.has(dir)) {
|
|
58
|
+
seenDirs.add(dir);
|
|
59
|
+
rows.push({
|
|
60
|
+
kind: "dir",
|
|
61
|
+
path: dir,
|
|
62
|
+
name: parts[i],
|
|
63
|
+
depth: i
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (collapsed.has(dir)) hidden = true;
|
|
67
|
+
}
|
|
68
|
+
if (!hidden) rows.push({
|
|
69
|
+
kind: "file",
|
|
70
|
+
path,
|
|
71
|
+
name: parts[parts.length - 1],
|
|
72
|
+
depth: parts.length - 1
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return rows.filter((row) => !row.path.split("/").slice(0, -1).some((_, i, arr) => collapsed.has(arr.slice(0, i + 1).join("/"))));
|
|
76
|
+
}
|
|
77
|
+
function FileLines({
|
|
78
|
+
text,
|
|
79
|
+
path,
|
|
80
|
+
theme,
|
|
81
|
+
focusLine
|
|
82
|
+
}) {
|
|
83
|
+
const lines = useMemo(() => text.split("\n"), [text]);
|
|
84
|
+
const tokens = useMemo(() => text.length <= MAX_HIGHLIGHT_CHARS ? highlightLines(lines, codeLanguage(path)) : null, [lines, path, text.length]);
|
|
85
|
+
const colors = useMemo(() => tokenColors(theme.isDark), [theme.isDark]);
|
|
86
|
+
const listRef = useRef(null);
|
|
87
|
+
const gutter = String(lines.length).length * 8 + 14;
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (!focusLine || focusLine < 1) return;
|
|
90
|
+
const index = Math.min(focusLine - 1, lines.length - 1);
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
var _a;
|
|
93
|
+
return (_a = listRef.current) == null ? void 0 : _a.scrollToIndex({
|
|
94
|
+
index,
|
|
95
|
+
animated: false,
|
|
96
|
+
viewPosition: 0.3
|
|
97
|
+
});
|
|
98
|
+
}, 50);
|
|
99
|
+
}, [focusLine, lines.length]);
|
|
100
|
+
return /* @__PURE__ */ jsx(ScrollView, { horizontal: true, style: styles.fill, contentContainerStyle: styles.hScroll, children: /* @__PURE__ */ jsx(FlatList, { ref: listRef, data: lines, keyExtractor: (_, i) => String(i), getItemLayout: (_, index) => ({
|
|
101
|
+
length: LINE_HEIGHT,
|
|
102
|
+
offset: LINE_HEIGHT * index,
|
|
103
|
+
index
|
|
104
|
+
}), initialNumToRender: 60, windowSize: 11, renderItem: ({
|
|
105
|
+
item,
|
|
106
|
+
index
|
|
107
|
+
}) => {
|
|
108
|
+
var _a;
|
|
109
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.lineRow, index + 1 === focusLine && {
|
|
110
|
+
backgroundColor: theme.accentSoft
|
|
111
|
+
}], children: [
|
|
112
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.lineNo, {
|
|
113
|
+
width: gutter,
|
|
114
|
+
color: theme.faint
|
|
115
|
+
}], children: index + 1 }),
|
|
116
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.lineText, {
|
|
117
|
+
color: theme.ink
|
|
118
|
+
}], children: tokens && ((_a = tokens[index]) == null ? void 0 : _a.length) ? tokens[index].map((tok, t) => /* @__PURE__ */ jsx(Text, { style: colors[tok.kind] ? {
|
|
119
|
+
color: colors[tok.kind]
|
|
120
|
+
} : null, children: tok.text }, t)) : item || " " })
|
|
121
|
+
] });
|
|
122
|
+
} }) });
|
|
123
|
+
}
|
|
124
|
+
function PostedFiles({
|
|
16
125
|
files,
|
|
17
126
|
theme,
|
|
18
127
|
onAsk
|
|
@@ -24,76 +133,597 @@ function CodeView({
|
|
|
24
133
|
var _a2;
|
|
25
134
|
if (!path || !paths.includes(path)) setPath((_a2 = paths[0]) != null ? _a2 : null);
|
|
26
135
|
}, [paths, path]);
|
|
27
|
-
if (!files || paths.length
|
|
28
|
-
return /* @__PURE__ */ jsx(CenteredState, { icon: "code-tags", title: "No code
|
|
136
|
+
if (!files || !paths.length) {
|
|
137
|
+
return /* @__PURE__ */ jsx(CenteredState, { icon: "code-tags", title: "No code yet", body: "The site's files show here once the agent has built it.", theme, primary: {
|
|
29
138
|
label: "Ask the agent",
|
|
30
|
-
icon: "creation",
|
|
31
139
|
onPress: onAsk
|
|
32
|
-
}
|
|
140
|
+
} });
|
|
33
141
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/* @__PURE__ */ jsx(
|
|
40
|
-
|
|
142
|
+
const text = path ? (_a = files[path]) != null ? _a : "" : "";
|
|
143
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.fill, children: [
|
|
144
|
+
/* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: styles.tabs, children: paths.map((p) => /* @__PURE__ */ jsx(Tap, { onPress: () => setPath(p), style: [styles.tab, {
|
|
145
|
+
borderColor: theme.border,
|
|
146
|
+
backgroundColor: p === path ? theme.chip : "transparent"
|
|
147
|
+
}], pressedStyle: DIM, children: /* @__PURE__ */ jsx(Text, { style: [styles.tabText, {
|
|
148
|
+
color: theme.ink
|
|
149
|
+
}], numberOfLines: 1, children: p.split("/").pop() }) }, p)) }),
|
|
150
|
+
/* @__PURE__ */ jsx(FileLines, { text: text.length > MAX_FALLBACK_CHARS ? text.slice(0, MAX_FALLBACK_CHARS) : text, path: path != null ? path : "", theme })
|
|
151
|
+
] });
|
|
152
|
+
}
|
|
153
|
+
function CodeView({
|
|
154
|
+
files,
|
|
155
|
+
build = null,
|
|
156
|
+
code,
|
|
157
|
+
busy = false,
|
|
158
|
+
onWake,
|
|
159
|
+
theme,
|
|
160
|
+
onAsk
|
|
161
|
+
}) {
|
|
162
|
+
var _a, _b;
|
|
163
|
+
const [tab, setTab] = useState("files");
|
|
164
|
+
const [tree, setTree] = useState(null);
|
|
165
|
+
const [treeError, setTreeError] = useState(null);
|
|
166
|
+
const [asleep, setAsleep] = useState(false);
|
|
167
|
+
const [waking, setWaking] = useState(false);
|
|
168
|
+
const [loadingTree, setLoadingTree] = useState(false);
|
|
169
|
+
const [collapsed, setCollapsed] = useState(/* @__PURE__ */ new Set());
|
|
170
|
+
const [open, setOpen] = useState(null);
|
|
171
|
+
const [opening, setOpening] = useState(false);
|
|
172
|
+
const [focusLine, setFocusLine] = useState(null);
|
|
173
|
+
const [editing, setEditing] = useState(false);
|
|
174
|
+
const [saving, setSaving] = useState(false);
|
|
175
|
+
const [drafts, setDrafts] = useState({});
|
|
176
|
+
const [notice, setNotice] = useState(null);
|
|
177
|
+
const buildKey = (_a = build == null ? void 0 : build.key) != null ? _a : null;
|
|
178
|
+
const loadTree = useCallback(() => {
|
|
179
|
+
if (!code || !build) return;
|
|
180
|
+
setLoadingTree(true);
|
|
181
|
+
setTreeError(null);
|
|
182
|
+
setAsleep(false);
|
|
183
|
+
code.listFiles(build).then((r) => {
|
|
184
|
+
if (r.ok && r.files) setTree({
|
|
185
|
+
files: r.files,
|
|
186
|
+
partial: Boolean(r.partial),
|
|
187
|
+
saved: Boolean(r.saved)
|
|
188
|
+
});
|
|
189
|
+
else {
|
|
190
|
+
setAsleep(Boolean(r.asleep));
|
|
191
|
+
setTreeError(r.error || "Could not list the project files.");
|
|
192
|
+
}
|
|
193
|
+
}).catch(() => setTreeError("Could not list the project files.")).finally(() => setLoadingTree(false));
|
|
194
|
+
}, [code, build]);
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
setTree(null);
|
|
197
|
+
setOpen(null);
|
|
198
|
+
setEditing(false);
|
|
199
|
+
setDrafts({});
|
|
200
|
+
loadTree();
|
|
201
|
+
}, [buildKey, build == null ? void 0 : build.updatedAt, Boolean(code)]);
|
|
202
|
+
const openFile = useCallback((path, line) => {
|
|
203
|
+
if (!code || !build) return;
|
|
204
|
+
setOpening(true);
|
|
205
|
+
setEditing(false);
|
|
206
|
+
setFocusLine(line != null ? line : null);
|
|
207
|
+
code.readFile(build, path, Boolean(tree == null ? void 0 : tree.saved)).then((r) => {
|
|
208
|
+
var _a2, _b2;
|
|
209
|
+
if (!r.ok) {
|
|
210
|
+
setNotice(r.error || "Could not read the file.");
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
setOpen({
|
|
214
|
+
path,
|
|
215
|
+
base: (_a2 = r.content) != null ? _a2 : "",
|
|
216
|
+
mode: (_b2 = r.mode) != null ? _b2 : {
|
|
217
|
+
kind: "error",
|
|
218
|
+
message: "The file came back empty."
|
|
219
|
+
},
|
|
220
|
+
saved: Boolean(r.saved)
|
|
221
|
+
});
|
|
222
|
+
setNotice(null);
|
|
223
|
+
}).catch(() => setNotice("Could not read the file.")).finally(() => setOpening(false));
|
|
224
|
+
}, [code, build, tree == null ? void 0 : tree.saved]);
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
if (tree && !open && tree.files.length) {
|
|
227
|
+
const first = preferredFile(tree.files);
|
|
228
|
+
if (first) openFile(first);
|
|
229
|
+
}
|
|
230
|
+
}, [tree]);
|
|
231
|
+
const draft = open ? (_b = drafts[open.path]) != null ? _b : open.base : "";
|
|
232
|
+
const dirty = Boolean(open && drafts[open.path] !== void 0 && drafts[open.path] !== open.base);
|
|
233
|
+
const readOnlyReason = (() => {
|
|
234
|
+
if (!open) return null;
|
|
235
|
+
if ((tree == null ? void 0 : tree.saved) || open.saved) return "Viewing saved code. Wake the site to edit.";
|
|
236
|
+
if (busy) return "Read-only while the agent works on the site.";
|
|
237
|
+
if (open.mode.kind === "readonly") return "This file is over 1 MB, so it opens read-only.";
|
|
238
|
+
return null;
|
|
239
|
+
})();
|
|
240
|
+
const save = (force = false) => {
|
|
241
|
+
if (!code || !build || !open) return;
|
|
242
|
+
setSaving(true);
|
|
243
|
+
code.saveFile(build, open.path, open.base, draft, force).then((r) => {
|
|
244
|
+
var _a2;
|
|
245
|
+
if (r.conflict) {
|
|
246
|
+
const disk = (_a2 = r.disk) != null ? _a2 : "";
|
|
247
|
+
Alert.alert("This file changed", "It changed on the site since you opened it (the agent, or someone else). Keep your version or load theirs?", [{
|
|
248
|
+
text: "Load theirs",
|
|
249
|
+
onPress: () => {
|
|
250
|
+
setOpen(__spreadProps(__spreadValues({}, open), {
|
|
251
|
+
base: disk
|
|
252
|
+
}));
|
|
253
|
+
setDrafts((prev) => {
|
|
254
|
+
var _a3;
|
|
255
|
+
const _b2 = prev, {
|
|
256
|
+
[_a3 = open.path]: _drop
|
|
257
|
+
} = _b2, rest = __objRest(_b2, [
|
|
258
|
+
__restKey(_a3)
|
|
259
|
+
]);
|
|
260
|
+
return rest;
|
|
261
|
+
});
|
|
262
|
+
setEditing(false);
|
|
263
|
+
}
|
|
264
|
+
}, {
|
|
265
|
+
text: "Overwrite",
|
|
266
|
+
style: "destructive",
|
|
267
|
+
onPress: () => save(true)
|
|
268
|
+
}, {
|
|
269
|
+
text: "Cancel",
|
|
270
|
+
style: "cancel"
|
|
271
|
+
}]);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (!r.ok) {
|
|
275
|
+
setNotice(r.error || "Could not save the file.");
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
setOpen(__spreadProps(__spreadValues({}, open), {
|
|
279
|
+
base: draft
|
|
280
|
+
}));
|
|
281
|
+
setDrafts((prev) => {
|
|
282
|
+
var _a3;
|
|
283
|
+
const _b2 = prev, {
|
|
284
|
+
[_a3 = open.path]: _drop
|
|
285
|
+
} = _b2, rest = __objRest(_b2, [
|
|
286
|
+
__restKey(_a3)
|
|
287
|
+
]);
|
|
288
|
+
return rest;
|
|
289
|
+
});
|
|
290
|
+
setEditing(false);
|
|
291
|
+
setNotice(r.unchanged ? "No changes to save." : "Saved. The agent will keep this change.");
|
|
292
|
+
}).catch(() => setNotice("Could not save the file.")).finally(() => setSaving(false));
|
|
293
|
+
};
|
|
294
|
+
const [query, setQuery] = useState("");
|
|
295
|
+
const [searching, setSearching] = useState(false);
|
|
296
|
+
const [results, setResults] = useState(null);
|
|
297
|
+
const nameMatches = useMemo(() => tree ? matchFileNames(tree.files, query) : [], [tree, query]);
|
|
298
|
+
const runSearch = () => {
|
|
299
|
+
if (!code || !build || !normalizeQuery(query)) return;
|
|
300
|
+
setSearching(true);
|
|
301
|
+
const openDocs = __spreadValues(__spreadValues({}, open ? {
|
|
302
|
+
[open.path]: open.base
|
|
303
|
+
} : {}), drafts);
|
|
304
|
+
code.search(build, query, !(tree == null ? void 0 : tree.saved), openDocs).then(setResults).catch(() => setResults(null)).finally(() => setSearching(false));
|
|
305
|
+
};
|
|
306
|
+
if (!code || !build) return /* @__PURE__ */ jsx(PostedFiles, { files, theme, onAsk });
|
|
307
|
+
const rows = tree ? treeRows(tree.files, collapsed) : [];
|
|
308
|
+
const header = /* @__PURE__ */ jsx(View, { style: [styles.segment, {
|
|
309
|
+
backgroundColor: theme.chip
|
|
310
|
+
}], children: ["files", "search"].map((value) => /* @__PURE__ */ jsxs(Tap, { onPress: () => setTab(value), accessibilityRole: "button", accessibilityState: {
|
|
311
|
+
selected: tab === value
|
|
312
|
+
}, style: [styles.segmentItem, tab === value && {
|
|
313
|
+
backgroundColor: theme.card
|
|
314
|
+
}], pressedStyle: DIM, children: [
|
|
315
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: value === "files" ? "file-tree-outline" : "magnify", size: 16, color: tab === value ? theme.ink : theme.muted }),
|
|
316
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.segmentText, {
|
|
317
|
+
color: tab === value ? theme.ink : theme.muted
|
|
318
|
+
}], children: value === "files" ? "Files" : "Search" })
|
|
319
|
+
] }, value)) });
|
|
320
|
+
const noticeBar = notice ? /* @__PURE__ */ jsx(Tap, { onPress: () => setNotice(null), style: [styles.notice, {
|
|
321
|
+
backgroundColor: theme.chip
|
|
322
|
+
}], pressedStyle: DIM, children: /* @__PURE__ */ jsx(Text, { style: [styles.noticeText, {
|
|
323
|
+
color: theme.ink
|
|
324
|
+
}], children: notice }) }) : null;
|
|
325
|
+
if (tab === "files" && open) {
|
|
326
|
+
let body;
|
|
327
|
+
if (open.mode.kind === "binary") {
|
|
328
|
+
body = /* @__PURE__ */ jsx(CenteredState, { icon: "file-image-outline", title: "Can't show this file", body: "Images, fonts and other binary files aren't shown here.", theme });
|
|
329
|
+
} else if (open.mode.kind === "error") {
|
|
330
|
+
body = /* @__PURE__ */ jsx(CenteredState, { icon: "alert-circle-outline", title: "Couldn't open this file", body: open.mode.message, theme });
|
|
331
|
+
} else if (editing) {
|
|
332
|
+
body = /* @__PURE__ */ jsx(TextInput, { value: draft, onChangeText: (text) => setDrafts((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
333
|
+
[open.path]: text
|
|
334
|
+
})), multiline: true, autoCapitalize: "none", autoCorrect: false, spellCheck: false, textAlignVertical: "top", style: [styles.editor, {
|
|
335
|
+
color: theme.ink,
|
|
336
|
+
backgroundColor: theme.card
|
|
337
|
+
}], accessibilityLabel: `Edit ${open.path}`, testID: "webbuilder-code-editor" });
|
|
338
|
+
} else {
|
|
339
|
+
body = /* @__PURE__ */ jsx(FileLines, { text: draft, path: open.path, theme, focusLine });
|
|
340
|
+
}
|
|
341
|
+
const canEdit = !readOnlyReason && open.mode.kind === "edit";
|
|
342
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.fill, children: [
|
|
343
|
+
/* @__PURE__ */ jsxs(View, { style: [styles.fileBar, {
|
|
344
|
+
borderBottomColor: theme.border
|
|
345
|
+
}], children: [
|
|
346
|
+
/* @__PURE__ */ jsx(Tap, { onPress: () => {
|
|
347
|
+
setOpen(null);
|
|
348
|
+
setEditing(false);
|
|
349
|
+
}, accessibilityRole: "button", accessibilityLabel: "All files", hitSlop: 8, pressedStyle: DIM, children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "chevron-left", size: 24, color: theme.ink }) }),
|
|
350
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.filePath, {
|
|
351
|
+
color: theme.ink
|
|
352
|
+
}], numberOfLines: 1, children: [
|
|
353
|
+
open.path,
|
|
354
|
+
dirty ? " \u2022" : ""
|
|
355
|
+
] }),
|
|
356
|
+
editing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
357
|
+
/* @__PURE__ */ jsx(Tap, { onPress: () => setEditing(false), style: styles.barAction, pressedStyle: DIM, accessibilityRole: "button", children: /* @__PURE__ */ jsx(Text, { style: [styles.barActionText, {
|
|
358
|
+
color: theme.muted
|
|
359
|
+
}], children: "Done" }) }),
|
|
360
|
+
/* @__PURE__ */ jsx(Tap, { onPress: () => save(), disabled: saving || !dirty, style: [styles.saveButton, {
|
|
361
|
+
backgroundColor: theme.accent
|
|
362
|
+
}, (!dirty || saving) && styles.disabled], pressedStyle: DIM, accessibilityRole: "button", testID: "webbuilder-code-save", children: saving ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: theme.accentInk }) : /* @__PURE__ */ jsx(Text, { style: [styles.saveText, {
|
|
363
|
+
color: theme.accentInk
|
|
364
|
+
}], children: "Save" }) })
|
|
365
|
+
] }) : /* @__PURE__ */ jsxs(Tap, { onPress: () => setEditing(true), disabled: !canEdit, style: [styles.barAction, !canEdit && styles.disabled], pressedStyle: DIM, accessibilityRole: "button", testID: "webbuilder-code-edit", children: [
|
|
366
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "pencil-outline", size: 18, color: theme.ink }),
|
|
367
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.barActionText, {
|
|
368
|
+
color: theme.ink
|
|
369
|
+
}], children: "Edit" })
|
|
370
|
+
] })
|
|
371
|
+
] }),
|
|
372
|
+
readOnlyReason ? /* @__PURE__ */ jsxs(View, { style: [styles.banner, {
|
|
373
|
+
backgroundColor: theme.chip
|
|
374
|
+
}], children: [
|
|
375
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "lock-outline", size: 14, color: theme.muted }),
|
|
376
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.bannerText, {
|
|
377
|
+
color: theme.muted
|
|
378
|
+
}], children: readOnlyReason })
|
|
379
|
+
] }) : null,
|
|
380
|
+
noticeBar,
|
|
381
|
+
body
|
|
382
|
+
] });
|
|
383
|
+
}
|
|
384
|
+
if (tab === "search") {
|
|
385
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.fill, children: [
|
|
386
|
+
header,
|
|
387
|
+
/* @__PURE__ */ jsxs(View, { style: [styles.searchBox, {
|
|
388
|
+
borderColor: theme.border,
|
|
389
|
+
backgroundColor: theme.card
|
|
390
|
+
}], children: [
|
|
391
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "magnify", size: 18, color: theme.muted }),
|
|
392
|
+
/* @__PURE__ */ jsx(TextInput, { value: query, onChangeText: setQuery, onSubmitEditing: runSearch, returnKeyType: "search", placeholder: "Search the code", placeholderTextColor: theme.faint, autoCapitalize: "none", autoCorrect: false, style: [styles.searchInput, {
|
|
393
|
+
color: theme.ink
|
|
394
|
+
}], testID: "webbuilder-code-search" }),
|
|
395
|
+
searching ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: theme.accent }) : null
|
|
396
|
+
] }),
|
|
397
|
+
/* @__PURE__ */ jsxs(ScrollView, { style: styles.fill, keyboardShouldPersistTaps: "handled", children: [
|
|
398
|
+
nameMatches.length ? /* @__PURE__ */ jsx(Text, { style: [styles.sectionLabel, {
|
|
399
|
+
color: theme.muted
|
|
400
|
+
}], children: "Files" }) : null,
|
|
401
|
+
nameMatches.map((path) => /* @__PURE__ */ jsxs(Tap, { onPress: () => {
|
|
402
|
+
setTab("files");
|
|
403
|
+
openFile(path);
|
|
404
|
+
}, style: styles.resultRow, pressedStyle: DIM, children: [
|
|
405
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "file-document-outline", size: 16, color: theme.muted }),
|
|
406
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.resultPath, {
|
|
407
|
+
color: theme.ink
|
|
408
|
+
}], numberOfLines: 1, children: path })
|
|
409
|
+
] }, `name-${path}`)),
|
|
410
|
+
results ? /* @__PURE__ */ jsx(Text, { style: [styles.sectionLabel, {
|
|
411
|
+
color: theme.muted
|
|
412
|
+
}], children: results.result.total ? `${results.result.total}${results.result.truncated ? "+" : ""} matches${results.source === "open-files" ? " in the open files" : ""}` : "No matches" }) : null,
|
|
413
|
+
results == null ? void 0 : results.result.files.map((file) => /* @__PURE__ */ jsxs(View, { style: styles.hitGroup, children: [
|
|
414
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.resultPath, {
|
|
415
|
+
color: theme.ink
|
|
416
|
+
}], numberOfLines: 1, children: file.path }),
|
|
417
|
+
file.matches.map((m) => /* @__PURE__ */ jsxs(Tap, { onPress: () => {
|
|
418
|
+
setTab("files");
|
|
419
|
+
openFile(file.path, m.line);
|
|
420
|
+
}, style: styles.hitRow, pressedStyle: DIM, children: [
|
|
421
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.hitLine, {
|
|
422
|
+
color: theme.faint
|
|
423
|
+
}], children: m.line }),
|
|
424
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.hitText, {
|
|
425
|
+
color: theme.ink
|
|
426
|
+
}], numberOfLines: 1, children: m.ranges.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
427
|
+
m.text.slice(0, m.ranges[0][0]),
|
|
428
|
+
/* @__PURE__ */ jsx(Text, { style: {
|
|
429
|
+
backgroundColor: theme.accentSoft,
|
|
430
|
+
color: theme.accent
|
|
431
|
+
}, children: m.text.slice(m.ranges[0][0], m.ranges[0][1]) }),
|
|
432
|
+
m.text.slice(m.ranges[0][1])
|
|
433
|
+
] }) : m.text })
|
|
434
|
+
] }, `${file.path}:${m.line}`))
|
|
435
|
+
] }, `hit-${file.path}`)),
|
|
436
|
+
!results && !nameMatches.length ? /* @__PURE__ */ jsx(Text, { style: [styles.searchHint, {
|
|
437
|
+
color: theme.muted
|
|
438
|
+
}], children: "Find text across the site's files: a name, a class, a word on the page." }) : null
|
|
439
|
+
] })
|
|
440
|
+
] });
|
|
441
|
+
}
|
|
442
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.fill, children: [
|
|
443
|
+
header,
|
|
444
|
+
(tree == null ? void 0 : tree.saved) ? /* @__PURE__ */ jsxs(View, { style: [styles.banner, {
|
|
445
|
+
backgroundColor: theme.chip
|
|
446
|
+
}], children: [
|
|
447
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "archive-outline", size: 14, color: theme.muted }),
|
|
448
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.bannerText, {
|
|
449
|
+
color: theme.muted
|
|
450
|
+
}], children: "Viewing saved code. Wake the site to edit." })
|
|
451
|
+
] }) : null,
|
|
452
|
+
noticeBar,
|
|
453
|
+
loadingTree && !tree ? /* @__PURE__ */ jsx(View, { style: styles.center, children: /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.accent }) }) : null,
|
|
454
|
+
treeError && !tree && !(asleep && files) ? /* @__PURE__ */ jsx(CenteredState, { icon: asleep ? "power-sleep" : "folder-alert-outline", title: asleep ? "The site is asleep" : "Couldn't load the files", body: treeError, theme, busy: waking, primary: asleep && onWake ? {
|
|
455
|
+
label: waking ? "Waking the site\u2026" : "Wake the site",
|
|
456
|
+
onPress: () => {
|
|
457
|
+
setWaking(true);
|
|
458
|
+
Promise.resolve(onWake()).catch(() => void 0).finally(() => {
|
|
459
|
+
setWaking(false);
|
|
460
|
+
loadTree();
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
} : {
|
|
464
|
+
label: "Try again",
|
|
465
|
+
onPress: loadTree
|
|
466
|
+
}, secondary: asleep && onWake ? {
|
|
467
|
+
label: "Try again",
|
|
468
|
+
onPress: loadTree
|
|
469
|
+
} : void 0 }) : null,
|
|
470
|
+
treeError && !tree && asleep && files ? /* @__PURE__ */ jsx(PostedFiles, { files, theme, onAsk }) : null,
|
|
471
|
+
tree ? /* @__PURE__ */ jsx(FlatList, { data: rows, keyExtractor: (row) => `${row.kind}:${row.path}`, refreshing: loadingTree, onRefresh: loadTree, ListFooterComponent: tree.partial ? /* @__PURE__ */ jsxs(Text, { style: [styles.searchHint, {
|
|
472
|
+
color: theme.muted
|
|
473
|
+
}], children: [
|
|
474
|
+
"Showing the first ",
|
|
475
|
+
tree.files.length,
|
|
476
|
+
" files."
|
|
477
|
+
] }) : null, renderItem: ({
|
|
478
|
+
item
|
|
479
|
+
}) => {
|
|
480
|
+
const isDir = item.kind === "dir";
|
|
481
|
+
const isCollapsed = collapsed.has(item.path);
|
|
482
|
+
let treeIcon = "file-document-outline";
|
|
483
|
+
if (isDir) treeIcon = isCollapsed ? "folder-outline" : "folder-open-outline";
|
|
484
|
+
return /* @__PURE__ */ jsxs(Tap, { onPress: () => {
|
|
485
|
+
if (isDir) {
|
|
486
|
+
setCollapsed((prev) => {
|
|
487
|
+
const next = new Set(prev);
|
|
488
|
+
if (next.has(item.path)) next.delete(item.path);
|
|
489
|
+
else next.add(item.path);
|
|
490
|
+
return next;
|
|
491
|
+
});
|
|
492
|
+
} else {
|
|
493
|
+
openFile(item.path);
|
|
494
|
+
}
|
|
495
|
+
}, style: [styles.treeRow, {
|
|
496
|
+
paddingLeft: 16 + item.depth * 16
|
|
497
|
+
}], pressedStyle: DIM, accessibilityRole: "button", accessibilityLabel: isDir ? `Folder ${item.name}` : `Open ${item.path}`, children: [
|
|
498
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: treeIcon, size: 18, color: isDir ? theme.accent : theme.muted }),
|
|
499
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.treeName, {
|
|
500
|
+
color: theme.ink
|
|
501
|
+
}, isDir && styles.treeDir], numberOfLines: 1, children: item.name }),
|
|
502
|
+
!isDir && drafts[item.path] !== void 0 ? /* @__PURE__ */ jsx(View, { style: [styles.dirtyDot, {
|
|
503
|
+
backgroundColor: theme.accent
|
|
504
|
+
}] }) : null
|
|
505
|
+
] });
|
|
506
|
+
} }) : null,
|
|
507
|
+
opening ? /* @__PURE__ */ jsx(View, { style: [styles.opening, {
|
|
41
508
|
backgroundColor: theme.card
|
|
42
|
-
}],
|
|
43
|
-
const active = p === path;
|
|
44
|
-
return /* @__PURE__ */ jsxs(Tap, { onPress: () => setPath(p), accessibilityRole: "tab", accessibilityState: {
|
|
45
|
-
selected: active
|
|
46
|
-
}, style: [styles.tab, {
|
|
47
|
-
borderColor: active ? theme.accent : theme.border
|
|
48
|
-
}, active && {
|
|
49
|
-
backgroundColor: theme.accentSoft
|
|
50
|
-
}], pressedStyle: DIM, children: [
|
|
51
|
-
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "file-code-outline", size: 14, color: active ? theme.accent : theme.muted }),
|
|
52
|
-
/* @__PURE__ */ jsx(Text, { style: [styles.tabLabel, {
|
|
53
|
-
color: active ? theme.accent : theme.muted
|
|
54
|
-
}], numberOfLines: 1, children: p })
|
|
55
|
-
] }, p);
|
|
56
|
-
}) }),
|
|
57
|
-
/* @__PURE__ */ jsx(ScrollView, { style: [styles.fill, {
|
|
58
|
-
backgroundColor: theme.code
|
|
59
|
-
}], children: /* @__PURE__ */ jsx(ScrollView, { horizontal: true, contentContainerStyle: styles.codePad, children: /* @__PURE__ */ jsx(Text, { selectable: true, style: [styles.code, {
|
|
60
|
-
color: theme.codeInk,
|
|
61
|
-
fontFamily: MONO
|
|
62
|
-
}], children: shown }) }) })
|
|
509
|
+
}], children: /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: theme.accent }) }) : null
|
|
63
510
|
] });
|
|
64
511
|
}
|
|
65
512
|
const styles = StyleSheet.create({
|
|
66
513
|
fill: {
|
|
67
514
|
flex: 1
|
|
68
515
|
},
|
|
516
|
+
center: {
|
|
517
|
+
padding: 32,
|
|
518
|
+
alignItems: "center"
|
|
519
|
+
},
|
|
520
|
+
hScroll: {
|
|
521
|
+
minWidth: "100%"
|
|
522
|
+
},
|
|
523
|
+
lineRow: {
|
|
524
|
+
flexDirection: "row",
|
|
525
|
+
height: LINE_HEIGHT,
|
|
526
|
+
alignItems: "center"
|
|
527
|
+
},
|
|
528
|
+
lineNo: {
|
|
529
|
+
fontFamily: MONO,
|
|
530
|
+
fontSize: 11,
|
|
531
|
+
textAlign: "right",
|
|
532
|
+
paddingRight: 10
|
|
533
|
+
},
|
|
534
|
+
lineText: {
|
|
535
|
+
fontFamily: MONO,
|
|
536
|
+
fontSize: 12.5,
|
|
537
|
+
paddingRight: 24
|
|
538
|
+
},
|
|
69
539
|
tabs: {
|
|
70
540
|
flexGrow: 0,
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
tabsContent: {
|
|
74
|
-
gap: 6,
|
|
75
|
-
paddingHorizontal: 10,
|
|
541
|
+
paddingHorizontal: 12,
|
|
76
542
|
paddingVertical: 8
|
|
77
543
|
},
|
|
78
544
|
tab: {
|
|
545
|
+
paddingHorizontal: 12,
|
|
546
|
+
paddingVertical: 6,
|
|
547
|
+
borderRadius: 999,
|
|
548
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
549
|
+
marginRight: 8
|
|
550
|
+
},
|
|
551
|
+
tabText: {
|
|
552
|
+
fontSize: 13,
|
|
553
|
+
fontWeight: "500",
|
|
554
|
+
maxWidth: 180
|
|
555
|
+
},
|
|
556
|
+
segment: {
|
|
557
|
+
flexDirection: "row",
|
|
558
|
+
margin: 12,
|
|
559
|
+
borderRadius: 12,
|
|
560
|
+
padding: 3
|
|
561
|
+
},
|
|
562
|
+
segmentItem: {
|
|
563
|
+
flex: 1,
|
|
79
564
|
flexDirection: "row",
|
|
80
565
|
alignItems: "center",
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
borderRadius: 8,
|
|
86
|
-
borderWidth: StyleSheet.hairlineWidth
|
|
566
|
+
justifyContent: "center",
|
|
567
|
+
gap: 6,
|
|
568
|
+
paddingVertical: 8,
|
|
569
|
+
borderRadius: 10
|
|
87
570
|
},
|
|
88
|
-
|
|
89
|
-
fontSize:
|
|
571
|
+
segmentText: {
|
|
572
|
+
fontSize: 14,
|
|
90
573
|
fontWeight: "600"
|
|
91
574
|
},
|
|
92
|
-
|
|
93
|
-
|
|
575
|
+
banner: {
|
|
576
|
+
flexDirection: "row",
|
|
577
|
+
alignItems: "center",
|
|
578
|
+
gap: 6,
|
|
579
|
+
marginHorizontal: 12,
|
|
580
|
+
marginBottom: 8,
|
|
581
|
+
padding: 10,
|
|
582
|
+
borderRadius: 10
|
|
583
|
+
},
|
|
584
|
+
bannerText: {
|
|
585
|
+
fontSize: 13,
|
|
586
|
+
flex: 1
|
|
94
587
|
},
|
|
95
|
-
|
|
588
|
+
notice: {
|
|
589
|
+
marginHorizontal: 12,
|
|
590
|
+
marginBottom: 8,
|
|
591
|
+
padding: 10,
|
|
592
|
+
borderRadius: 10
|
|
593
|
+
},
|
|
594
|
+
noticeText: {
|
|
595
|
+
fontSize: 13
|
|
596
|
+
},
|
|
597
|
+
treeRow: {
|
|
598
|
+
flexDirection: "row",
|
|
599
|
+
alignItems: "center",
|
|
600
|
+
gap: 8,
|
|
601
|
+
paddingVertical: 10,
|
|
602
|
+
paddingRight: 16
|
|
603
|
+
},
|
|
604
|
+
treeName: {
|
|
605
|
+
fontSize: 14,
|
|
606
|
+
flex: 1
|
|
607
|
+
},
|
|
608
|
+
treeDir: {
|
|
609
|
+
fontWeight: "600"
|
|
610
|
+
},
|
|
611
|
+
dirtyDot: {
|
|
612
|
+
width: 8,
|
|
613
|
+
height: 8,
|
|
614
|
+
borderRadius: 4
|
|
615
|
+
},
|
|
616
|
+
fileBar: {
|
|
617
|
+
flexDirection: "row",
|
|
618
|
+
alignItems: "center",
|
|
619
|
+
gap: 8,
|
|
620
|
+
paddingHorizontal: 12,
|
|
621
|
+
paddingVertical: 10,
|
|
622
|
+
borderBottomWidth: StyleSheet.hairlineWidth
|
|
623
|
+
},
|
|
624
|
+
filePath: {
|
|
625
|
+
flex: 1,
|
|
626
|
+
fontFamily: MONO,
|
|
627
|
+
fontSize: 13
|
|
628
|
+
},
|
|
629
|
+
barAction: {
|
|
630
|
+
flexDirection: "row",
|
|
631
|
+
alignItems: "center",
|
|
632
|
+
gap: 4,
|
|
633
|
+
paddingHorizontal: 8,
|
|
634
|
+
paddingVertical: 6
|
|
635
|
+
},
|
|
636
|
+
barActionText: {
|
|
637
|
+
fontSize: 14,
|
|
638
|
+
fontWeight: "600"
|
|
639
|
+
},
|
|
640
|
+
saveButton: {
|
|
641
|
+
paddingHorizontal: 14,
|
|
642
|
+
paddingVertical: 7,
|
|
643
|
+
borderRadius: 10,
|
|
644
|
+
minWidth: 64,
|
|
645
|
+
alignItems: "center"
|
|
646
|
+
},
|
|
647
|
+
saveText: {
|
|
648
|
+
fontSize: 14,
|
|
649
|
+
fontWeight: "700"
|
|
650
|
+
},
|
|
651
|
+
disabled: {
|
|
652
|
+
opacity: 0.4
|
|
653
|
+
},
|
|
654
|
+
editor: {
|
|
655
|
+
flex: 1,
|
|
656
|
+
fontFamily: MONO,
|
|
657
|
+
fontSize: 13,
|
|
658
|
+
padding: 12,
|
|
659
|
+
lineHeight: LINE_HEIGHT
|
|
660
|
+
},
|
|
661
|
+
searchBox: {
|
|
662
|
+
flexDirection: "row",
|
|
663
|
+
alignItems: "center",
|
|
664
|
+
gap: 8,
|
|
665
|
+
marginHorizontal: 12,
|
|
666
|
+
marginBottom: 8,
|
|
667
|
+
paddingHorizontal: 12,
|
|
668
|
+
borderRadius: 12,
|
|
669
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
670
|
+
height: 44
|
|
671
|
+
},
|
|
672
|
+
searchInput: {
|
|
673
|
+
flex: 1,
|
|
674
|
+
fontSize: 15
|
|
675
|
+
},
|
|
676
|
+
sectionLabel: {
|
|
677
|
+
fontSize: 12,
|
|
678
|
+
fontWeight: "700",
|
|
679
|
+
textTransform: "uppercase",
|
|
680
|
+
marginHorizontal: 16,
|
|
681
|
+
marginTop: 12,
|
|
682
|
+
marginBottom: 4
|
|
683
|
+
},
|
|
684
|
+
resultRow: {
|
|
685
|
+
flexDirection: "row",
|
|
686
|
+
alignItems: "center",
|
|
687
|
+
gap: 8,
|
|
688
|
+
paddingHorizontal: 16,
|
|
689
|
+
paddingVertical: 10
|
|
690
|
+
},
|
|
691
|
+
resultPath: {
|
|
692
|
+
fontFamily: MONO,
|
|
693
|
+
fontSize: 13,
|
|
694
|
+
flexShrink: 1
|
|
695
|
+
},
|
|
696
|
+
hitGroup: {
|
|
697
|
+
paddingHorizontal: 16,
|
|
698
|
+
paddingVertical: 8,
|
|
699
|
+
gap: 2
|
|
700
|
+
},
|
|
701
|
+
hitRow: {
|
|
702
|
+
flexDirection: "row",
|
|
703
|
+
gap: 10,
|
|
704
|
+
paddingVertical: 6
|
|
705
|
+
},
|
|
706
|
+
hitLine: {
|
|
707
|
+
fontFamily: MONO,
|
|
96
708
|
fontSize: 12,
|
|
97
|
-
|
|
709
|
+
minWidth: 32,
|
|
710
|
+
textAlign: "right"
|
|
711
|
+
},
|
|
712
|
+
hitText: {
|
|
713
|
+
fontFamily: MONO,
|
|
714
|
+
fontSize: 12.5,
|
|
715
|
+
flex: 1
|
|
716
|
+
},
|
|
717
|
+
searchHint: {
|
|
718
|
+
fontSize: 13,
|
|
719
|
+
textAlign: "center",
|
|
720
|
+
padding: 24
|
|
721
|
+
},
|
|
722
|
+
opening: {
|
|
723
|
+
position: "absolute",
|
|
724
|
+
top: 70,
|
|
725
|
+
alignSelf: "center",
|
|
726
|
+
padding: 10,
|
|
727
|
+
borderRadius: 20
|
|
98
728
|
}
|
|
99
|
-
});export{CodeView,orderedFiles};//# sourceMappingURL=CodeView.js.map
|
|
729
|
+
});export{CodeView,orderedFiles,treeRows};//# sourceMappingURL=CodeView.js.map
|