@adminide-stack/yantra-mobile 12.0.108-alpha.0 → 12.0.109-alpha.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/lib/compute.js +57 -1
- package/lib/compute.js.map +1 -1
- package/lib/config/env-config.js +8 -0
- package/lib/config/env-config.js.map +1 -1
- package/lib/features/apps/AppsCatalog.js +10 -0
- package/lib/features/apps/AppsCatalog.js.map +1 -1
- package/lib/features/apps/appArt.js +2 -1
- package/lib/features/apps/appArt.js.map +1 -1
- package/lib/features/apps/mobileAppCatalog.js +11 -0
- package/lib/features/apps/mobileAppCatalog.js.map +1 -1
- package/lib/features/apps/nativeAppHandoff.js +2 -1
- package/lib/features/apps/nativeAppHandoff.js.map +1 -1
- package/lib/features/health/healthSyncStore.js +7 -1
- package/lib/features/health/healthSyncStore.js.map +1 -1
- package/lib/features/messaging/NewGroupScreen.js.map +1 -1
- package/lib/features/messaging/useChatViewer.js +3 -2
- package/lib/features/messaging/useChatViewer.js.map +1 -1
- package/lib/features/webbuilder/WebBuilderExperience.js +474 -0
- package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -0
- package/lib/features/webbuilder/brandKitStorage.js +69 -0
- package/lib/features/webbuilder/brandKitStorage.js.map +1 -0
- package/lib/features/webbuilder/buildFragments.js +360 -0
- package/lib/features/webbuilder/buildFragments.js.map +1 -0
- package/lib/features/webbuilder/components/BottomTabs.js +65 -0
- package/lib/features/webbuilder/components/BottomTabs.js.map +1 -0
- package/lib/features/webbuilder/components/BrandKitSheet.js +197 -0
- package/lib/features/webbuilder/components/BrandKitSheet.js.map +1 -0
- package/lib/features/webbuilder/components/CodeView.js +99 -0
- package/lib/features/webbuilder/components/CodeView.js.map +1 -0
- package/lib/features/webbuilder/components/Composer.js +217 -0
- package/lib/features/webbuilder/components/Composer.js.map +1 -0
- package/lib/features/webbuilder/components/PreviewFrame.js +72 -0
- package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -0
- package/lib/features/webbuilder/components/PreviewPlaceholder.js +107 -0
- package/lib/features/webbuilder/components/PreviewPlaceholder.js.map +1 -0
- package/lib/features/webbuilder/components/PreviewScreen.js +200 -0
- package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -0
- package/lib/features/webbuilder/components/ProjectChat.js +580 -0
- package/lib/features/webbuilder/components/ProjectChat.js.map +1 -0
- package/lib/features/webbuilder/components/ProjectsScreen.js +339 -0
- package/lib/features/webbuilder/components/ProjectsScreen.js.map +1 -0
- package/lib/features/webbuilder/components/PublishSheet.js +143 -0
- package/lib/features/webbuilder/components/PublishSheet.js.map +1 -0
- package/lib/features/webbuilder/components/SiteScoreSheet.js +73 -0
- package/lib/features/webbuilder/components/SiteScoreSheet.js.map +1 -0
- package/lib/features/webbuilder/components/StudioHome.js +367 -0
- package/lib/features/webbuilder/components/StudioHome.js.map +1 -0
- package/lib/features/webbuilder/components/TemplateCard.js +73 -0
- package/lib/features/webbuilder/components/TemplateCard.js.map +1 -0
- package/lib/features/webbuilder/components/TemplatesSheet.js +178 -0
- package/lib/features/webbuilder/components/TemplatesSheet.js.map +1 -0
- package/lib/features/webbuilder/components/VersionsSheet.js +57 -0
- package/lib/features/webbuilder/components/VersionsSheet.js.map +1 -0
- package/lib/features/webbuilder/components/ui.js +291 -0
- package/lib/features/webbuilder/components/ui.js.map +1 -0
- package/lib/features/webbuilder/nativeWebBuilderRegistry.js +15 -0
- package/lib/features/webbuilder/nativeWebBuilderRegistry.js.map +1 -0
- package/lib/features/webbuilder/studioCatalog.js +147 -0
- package/lib/features/webbuilder/studioCatalog.js.map +1 -0
- package/lib/features/webbuilder/webbuilderPrompts.js +42 -0
- package/lib/features/webbuilder/webbuilderPrompts.js.map +1 -0
- package/lib/features/webbuilder/webbuilderTheme.js +63 -0
- package/lib/features/webbuilder/webbuilderTheme.js.map +1 -0
- package/lib/features/webbuilder/workflow.js +540 -0
- package/lib/features/webbuilder/workflow.js.map +1 -0
- package/lib/hooks/useChatApi.js +7 -2
- package/lib/hooks/useChatApi.js.map +1 -1
- package/lib/hooks/useChatStream.js +1 -1
- package/lib/hooks/useChatStream.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/routes.json +106 -0
- package/lib/screens/WebBuilderNative/index.js +71 -0
- package/lib/screens/WebBuilderNative/index.js.map +1 -0
- package/lib/screens/WebBuilderNative/useCodeAssistantCatalog.js +45 -0
- package/lib/screens/WebBuilderNative/useCodeAssistantCatalog.js.map +1 -0
- package/lib/screens/WebBuilderNative/useWebBuilderGallery.js +125 -0
- package/lib/screens/WebBuilderNative/useWebBuilderGallery.js.map +1 -0
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +408 -0
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -0
- package/lib/screens/WebBuilderNative/webbuilderTransport.js +88 -0
- package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import {useState,useRef,useMemo,useEffect}from'react';import {StyleSheet,KeyboardAvoidingView,FlatList,View,Text,TextInput,Platform,ActivityIndicator}from'react-native';import {WebView}from'react-native-webview';import {MaterialCommunityIcons}from'@expo/vector-icons';import {Tap,DIM}from'../../inbox/components/Tap.js';import {AssistantMarkdown}from'../../chat/AssistantMarkdown.js';import {ToolTimeline}from'../../chat/ToolTimeline.js';import {parseToolActivity}from'../../chat/toolActivity.js';import {displayHost}from'../buildFragments.js';import {DESKTOP_VIEWPORT_SCRIPT}from'./PreviewFrame.js';import {PreviewPlaceholder}from'./PreviewPlaceholder.js';import {webbuilderAgentSuggestions}from'../webbuilderPrompts.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
|
+
function elapsedLabel(seconds) {
|
|
21
|
+
if (seconds < 60) return `${seconds}s`;
|
|
22
|
+
return `${Math.floor(seconds / 60)}m ${String(seconds % 60).padStart(2, "0")}s`;
|
|
23
|
+
}
|
|
24
|
+
function useElapsed(startedAt) {
|
|
25
|
+
const [now, setNow] = useState(() => Date.now());
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!startedAt) return void 0;
|
|
28
|
+
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
29
|
+
return () => clearInterval(timer);
|
|
30
|
+
}, [startedAt]);
|
|
31
|
+
return startedAt ? Math.max(0, Math.floor((now - startedAt) / 1e3)) : 0;
|
|
32
|
+
}
|
|
33
|
+
function UserBubble({
|
|
34
|
+
text,
|
|
35
|
+
theme
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ jsx(View, { style: styles.userRow, children: /* @__PURE__ */ jsx(View, { style: [styles.userBubble, {
|
|
38
|
+
backgroundColor: theme.chip
|
|
39
|
+
}], children: /* @__PURE__ */ jsx(Text, { style: [styles.userText, {
|
|
40
|
+
color: theme.ink
|
|
41
|
+
}], selectable: true, children: text }) }) });
|
|
42
|
+
}
|
|
43
|
+
function AgentAvatar({
|
|
44
|
+
theme
|
|
45
|
+
}) {
|
|
46
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.agentHead, children: [
|
|
47
|
+
/* @__PURE__ */ jsx(View, { style: [styles.agentMark, {
|
|
48
|
+
backgroundColor: theme.accent
|
|
49
|
+
}], children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "creation", size: 14, color: theme.accentInk }) }),
|
|
50
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.agentName, {
|
|
51
|
+
color: theme.ink
|
|
52
|
+
}], children: "Web Builder" })
|
|
53
|
+
] });
|
|
54
|
+
}
|
|
55
|
+
function AgentTurn({
|
|
56
|
+
content,
|
|
57
|
+
active,
|
|
58
|
+
theme
|
|
59
|
+
}) {
|
|
60
|
+
const parsed = useMemo(() => parseToolActivity(content, active), [content, active]);
|
|
61
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.agentTurn, children: [
|
|
62
|
+
/* @__PURE__ */ jsx(AgentAvatar, { theme }),
|
|
63
|
+
parsed.steps.length ? /* @__PURE__ */ jsx(ToolTimeline, { steps: parsed.steps, active, isDark: theme.isDark }) : null,
|
|
64
|
+
parsed.text ? /* @__PURE__ */ jsx(AssistantMarkdown, { text: parsed.text, streaming: active, isDark: theme.isDark }) : null
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
function LiveTurn({
|
|
68
|
+
streaming,
|
|
69
|
+
building,
|
|
70
|
+
theme
|
|
71
|
+
}) {
|
|
72
|
+
var _a;
|
|
73
|
+
const elapsed = useElapsed((_a = building == null ? void 0 : building.startedAt) != null ? _a : null);
|
|
74
|
+
const parsed = useMemo(() => parseToolActivity(streaming != null ? streaming : "", true), [streaming]);
|
|
75
|
+
const showStatus = !parsed.text && parsed.steps.length === 0;
|
|
76
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.agentTurn, children: [
|
|
77
|
+
/* @__PURE__ */ jsx(AgentAvatar, { theme }),
|
|
78
|
+
parsed.steps.length ? /* @__PURE__ */ jsx(ToolTimeline, { steps: parsed.steps, active: true, isDark: theme.isDark }) : null,
|
|
79
|
+
parsed.text ? /* @__PURE__ */ jsx(AssistantMarkdown, { text: parsed.text, streaming: true, isDark: theme.isDark }) : null,
|
|
80
|
+
showStatus ? /* @__PURE__ */ jsxs(View, { style: [styles.working, {
|
|
81
|
+
backgroundColor: theme.card,
|
|
82
|
+
borderColor: theme.border
|
|
83
|
+
}], children: [
|
|
84
|
+
/* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: theme.accent }),
|
|
85
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.workingText, {
|
|
86
|
+
color: theme.ink
|
|
87
|
+
}], numberOfLines: 2, children: (building == null ? void 0 : building.statusText) || "Thinking\u2026" }),
|
|
88
|
+
building ? /* @__PURE__ */ jsx(Text, { style: [styles.workingTime, {
|
|
89
|
+
color: theme.muted
|
|
90
|
+
}], children: elapsedLabel(elapsed) }) : null
|
|
91
|
+
] }) : null
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
function timeOf(ms) {
|
|
95
|
+
if (!ms) return "";
|
|
96
|
+
const d = new Date(ms);
|
|
97
|
+
return `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
|
|
98
|
+
}
|
|
99
|
+
function SiteCard({
|
|
100
|
+
build,
|
|
101
|
+
title,
|
|
102
|
+
busy,
|
|
103
|
+
onOpen,
|
|
104
|
+
onPublish,
|
|
105
|
+
theme
|
|
106
|
+
}) {
|
|
107
|
+
const url = build.previewUrl;
|
|
108
|
+
const [loaded, setLoaded] = useState(false);
|
|
109
|
+
const [asleep, setAsleep] = useState(false);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
setLoaded(false);
|
|
112
|
+
setAsleep(false);
|
|
113
|
+
}, [url]);
|
|
114
|
+
const status = build.liveUrl ? `Live \xB7 ${displayHost(build.liveUrl)}` : `Not published \xB7 ${timeOf(build.updatedAt)}`;
|
|
115
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.site, {
|
|
116
|
+
backgroundColor: theme.card,
|
|
117
|
+
borderColor: theme.border,
|
|
118
|
+
shadowColor: theme.isDark ? "#000" : "#1c1917"
|
|
119
|
+
}], children: [
|
|
120
|
+
/* @__PURE__ */ jsxs(Tap, { onPress: onOpen, accessibilityRole: "button", accessibilityLabel: `Open ${title}`, style: styles.siteHead, pressedStyle: DIM, children: [
|
|
121
|
+
/* @__PURE__ */ jsx(View, { style: [styles.siteGlobe, {
|
|
122
|
+
backgroundColor: build.liveUrl ? theme.good : theme.accent
|
|
123
|
+
}], children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "web", size: 24, color: theme.accentInk }) }),
|
|
124
|
+
/* @__PURE__ */ jsxs(View, { style: styles.siteHeadText, children: [
|
|
125
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.siteTitle, {
|
|
126
|
+
color: theme.ink
|
|
127
|
+
}], numberOfLines: 1, children: title }),
|
|
128
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.siteStatus, {
|
|
129
|
+
color: theme.muted
|
|
130
|
+
}], numberOfLines: 1, children: status })
|
|
131
|
+
] })
|
|
132
|
+
] }),
|
|
133
|
+
/* @__PURE__ */ jsx(Tap, { onPress: onOpen, accessibilityRole: "button", accessibilityLabel: `Open the preview of ${title}`, children: /* @__PURE__ */ jsxs(View, { style: [styles.siteView, {
|
|
134
|
+
backgroundColor: theme.stage,
|
|
135
|
+
borderColor: theme.border
|
|
136
|
+
}], pointerEvents: "none", children: [
|
|
137
|
+
url ? /* @__PURE__ */ jsx(WebView, { source: {
|
|
138
|
+
uri: url
|
|
139
|
+
}, style: [styles.siteWeb, !loaded && styles.hidden], scrollEnabled: false, javaScriptEnabled: true, domStorageEnabled: true, originWhitelist: ["*"], scalesPageToFit: true, injectedJavaScript: DESKTOP_VIEWPORT_SCRIPT, onLoadEnd: () => setLoaded(true), onHttpError: (event) => {
|
|
140
|
+
if (event.nativeEvent.statusCode >= 500) setAsleep(true);
|
|
141
|
+
}, onError: () => setAsleep(true) }) : null,
|
|
142
|
+
asleep ? /* @__PURE__ */ jsx(View, { style: [styles.siteLoading, {
|
|
143
|
+
backgroundColor: theme.stage
|
|
144
|
+
}], children: /* @__PURE__ */ jsx(PreviewPlaceholder, { theme, compact: true }) }) : null,
|
|
145
|
+
!asleep && (!url || !loaded) ? /* @__PURE__ */ jsxs(View, { style: styles.siteLoading, children: [
|
|
146
|
+
/* @__PURE__ */ jsx(ActivityIndicator, { color: theme.accent }),
|
|
147
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.siteLoadingText, {
|
|
148
|
+
color: theme.muted
|
|
149
|
+
}], children: "Loading preview\u2026" })
|
|
150
|
+
] }) : null,
|
|
151
|
+
busy && loaded && !asleep ? /* @__PURE__ */ jsxs(View, { style: [styles.siteBusy, {
|
|
152
|
+
backgroundColor: theme.card
|
|
153
|
+
}], children: [
|
|
154
|
+
/* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: theme.accent }),
|
|
155
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.siteBusyText, {
|
|
156
|
+
color: theme.ink
|
|
157
|
+
}], children: "Updating\u2026" })
|
|
158
|
+
] }) : null
|
|
159
|
+
] }) }),
|
|
160
|
+
/* @__PURE__ */ jsxs(View, { style: styles.siteFoot, children: [
|
|
161
|
+
/* @__PURE__ */ jsx(Tap, { onPress: onOpen, accessibilityRole: "button", style: [styles.siteBtn, {
|
|
162
|
+
backgroundColor: theme.chip
|
|
163
|
+
}], pressedStyle: DIM, testID: "webbuilder-card-preview", children: /* @__PURE__ */ jsx(Text, { style: [styles.siteBtnText, {
|
|
164
|
+
color: theme.ink
|
|
165
|
+
}], children: "Preview" }) }),
|
|
166
|
+
/* @__PURE__ */ jsx(Tap, { onPress: onPublish, disabled: !build.sandboxId, accessibilityRole: "button", style: [styles.siteBtn, {
|
|
167
|
+
backgroundColor: theme.ink
|
|
168
|
+
}, !build.sandboxId && styles.disabled], pressedStyle: DIM, testID: "webbuilder-card-publish", children: /* @__PURE__ */ jsx(Text, { style: [styles.siteBtnText, {
|
|
169
|
+
color: theme.card
|
|
170
|
+
}], children: "Publish" }) })
|
|
171
|
+
] })
|
|
172
|
+
] });
|
|
173
|
+
}
|
|
174
|
+
function ProjectChat({
|
|
175
|
+
messages,
|
|
176
|
+
streaming,
|
|
177
|
+
busy,
|
|
178
|
+
error,
|
|
179
|
+
connected,
|
|
180
|
+
building,
|
|
181
|
+
build,
|
|
182
|
+
siteTitle,
|
|
183
|
+
onSend,
|
|
184
|
+
onOpenPreview,
|
|
185
|
+
onPublish,
|
|
186
|
+
theme,
|
|
187
|
+
bottomInset
|
|
188
|
+
}) {
|
|
189
|
+
const [draft, setDraft] = useState("");
|
|
190
|
+
const listRef = useRef(null);
|
|
191
|
+
const [atBottom, setAtBottom] = useState(true);
|
|
192
|
+
const live = busy || Boolean(building);
|
|
193
|
+
const rows = useMemo(() => {
|
|
194
|
+
const out = messages.map((m) => ({
|
|
195
|
+
kind: "message",
|
|
196
|
+
id: m.id,
|
|
197
|
+
message: m
|
|
198
|
+
}));
|
|
199
|
+
if (build) out.push({
|
|
200
|
+
kind: "site",
|
|
201
|
+
id: `site-${build.key}`
|
|
202
|
+
});
|
|
203
|
+
if (live) out.push({
|
|
204
|
+
kind: "live",
|
|
205
|
+
id: "live"
|
|
206
|
+
});
|
|
207
|
+
return out;
|
|
208
|
+
}, [messages, build, live]);
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
if (!atBottom) return void 0;
|
|
211
|
+
const timer = setTimeout(() => {
|
|
212
|
+
var _a;
|
|
213
|
+
return (_a = listRef.current) == null ? void 0 : _a.scrollToEnd({
|
|
214
|
+
animated: true
|
|
215
|
+
});
|
|
216
|
+
}, 80);
|
|
217
|
+
return () => clearTimeout(timer);
|
|
218
|
+
}, [rows.length, streaming]);
|
|
219
|
+
const send = (text) => {
|
|
220
|
+
const words = text.trim();
|
|
221
|
+
if (!words) return;
|
|
222
|
+
onSend(words);
|
|
223
|
+
setDraft("");
|
|
224
|
+
};
|
|
225
|
+
const suggestions = messages.length === 0 && !live ? webbuilderAgentSuggestions(Boolean(build), siteTitle) : [];
|
|
226
|
+
return /* @__PURE__ */ jsxs(KeyboardAvoidingView, { style: styles.fill, behavior: Platform.OS === "ios" ? "padding" : void 0, keyboardVerticalOffset: Platform.OS === "ios" ? 96 : 0, children: [
|
|
227
|
+
/* @__PURE__ */ jsx(FlatList, { ref: listRef, data: rows, keyExtractor: (row) => row.id, contentContainerStyle: styles.list, keyboardShouldPersistTaps: "handled", scrollEventThrottle: 100, onScroll: (event) => {
|
|
228
|
+
const {
|
|
229
|
+
layoutMeasurement,
|
|
230
|
+
contentOffset,
|
|
231
|
+
contentSize
|
|
232
|
+
} = event.nativeEvent;
|
|
233
|
+
setAtBottom(layoutMeasurement.height + contentOffset.y >= contentSize.height - 48);
|
|
234
|
+
}, ListEmptyComponent: /* @__PURE__ */ jsxs(View, { style: styles.empty, children: [
|
|
235
|
+
/* @__PURE__ */ jsx(View, { style: [styles.emptyMark, {
|
|
236
|
+
backgroundColor: theme.accentSoft
|
|
237
|
+
}], children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "creation", size: 26, color: theme.accent }) }),
|
|
238
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.emptyTitle, {
|
|
239
|
+
color: theme.ink
|
|
240
|
+
}], children: build ? `What should change on ${siteTitle}?` : "Describe your idea" }),
|
|
241
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.emptyBody, {
|
|
242
|
+
color: theme.muted
|
|
243
|
+
}], children: build ? "Ask for new sections, another look, copy changes or fixes." : "Tell me what the site is for and I'll build it step by step." })
|
|
244
|
+
] }), renderItem: ({
|
|
245
|
+
item
|
|
246
|
+
}) => {
|
|
247
|
+
var _a;
|
|
248
|
+
if (item.kind === "live") return /* @__PURE__ */ jsx(LiveTurn, { streaming, building, theme });
|
|
249
|
+
if (item.kind === "site" && build) {
|
|
250
|
+
return /* @__PURE__ */ jsx(SiteCard, { build, title: siteTitle, busy: live, onOpen: onOpenPreview, onPublish, theme });
|
|
251
|
+
}
|
|
252
|
+
if (item.kind !== "message") return null;
|
|
253
|
+
const m = item.message;
|
|
254
|
+
if (m.role === "user") return /* @__PURE__ */ jsx(UserBubble, { text: (_a = m.displayContent) != null ? _a : m.content, theme });
|
|
255
|
+
return /* @__PURE__ */ jsx(AgentTurn, { content: m.content, active: false, theme });
|
|
256
|
+
} }),
|
|
257
|
+
!atBottom ? /* @__PURE__ */ jsx(Tap, { onPress: () => {
|
|
258
|
+
var _a;
|
|
259
|
+
setAtBottom(true);
|
|
260
|
+
(_a = listRef.current) == null ? void 0 : _a.scrollToEnd({
|
|
261
|
+
animated: true
|
|
262
|
+
});
|
|
263
|
+
}, accessibilityRole: "button", accessibilityLabel: "Jump to the latest", style: [styles.jump, {
|
|
264
|
+
backgroundColor: theme.card,
|
|
265
|
+
borderColor: theme.border,
|
|
266
|
+
shadowColor: theme.isDark ? "#000" : "#1c1917"
|
|
267
|
+
}], pressedStyle: DIM, children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "arrow-down", size: 20, color: theme.ink }) }) : null,
|
|
268
|
+
suggestions.length ? /* @__PURE__ */ jsx(View, { style: styles.suggestions, children: suggestions.slice(0, 3).map((s) => /* @__PURE__ */ jsx(Tap, { onPress: () => {
|
|
269
|
+
var _a;
|
|
270
|
+
return send((_a = s.prompt) != null ? _a : s.label);
|
|
271
|
+
}, accessibilityRole: "button", style: [styles.suggestion, {
|
|
272
|
+
backgroundColor: theme.card,
|
|
273
|
+
borderColor: theme.border
|
|
274
|
+
}], pressedStyle: DIM, children: /* @__PURE__ */ jsx(Text, { style: [styles.suggestionText, {
|
|
275
|
+
color: theme.ink
|
|
276
|
+
}], numberOfLines: 1, children: s.label }) }, s.id)) }) : null,
|
|
277
|
+
error ? /* @__PURE__ */ jsxs(View, { style: [styles.error, {
|
|
278
|
+
backgroundColor: theme.critSoft
|
|
279
|
+
}], children: [
|
|
280
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "alert-circle-outline", size: 16, color: theme.crit }),
|
|
281
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.errorText, {
|
|
282
|
+
color: theme.crit
|
|
283
|
+
}], children: error })
|
|
284
|
+
] }) : null,
|
|
285
|
+
/* @__PURE__ */ jsxs(View, { style: [styles.composerDock, {
|
|
286
|
+
backgroundColor: theme.screen,
|
|
287
|
+
paddingBottom: Math.max(bottomInset, 10)
|
|
288
|
+
}], children: [
|
|
289
|
+
/* @__PURE__ */ jsxs(View, { style: [styles.composer, {
|
|
290
|
+
backgroundColor: theme.card,
|
|
291
|
+
borderColor: theme.border,
|
|
292
|
+
shadowColor: theme.isDark ? "#000" : "#1c1917"
|
|
293
|
+
}], children: [
|
|
294
|
+
/* @__PURE__ */ jsx(TextInput, { value: draft, onChangeText: setDraft, placeholder: "Message Web Builder", placeholderTextColor: theme.faint, multiline: true, style: [styles.input, {
|
|
295
|
+
color: theme.ink
|
|
296
|
+
}], accessibilityLabel: "Message the agent", testID: "webbuilder-chat-input" }),
|
|
297
|
+
/* @__PURE__ */ jsx(Tap, { onPress: () => send(draft), disabled: !draft.trim() || !connected, accessibilityRole: "button", accessibilityLabel: "Send", style: [styles.send, {
|
|
298
|
+
backgroundColor: draft.trim() && connected ? theme.accent : theme.chip
|
|
299
|
+
}], pressedStyle: DIM, testID: "webbuilder-chat-send", children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "arrow-up", size: 20, color: draft.trim() && connected ? theme.accentInk : theme.faint }) })
|
|
300
|
+
] }),
|
|
301
|
+
!connected ? /* @__PURE__ */ jsx(Text, { style: [styles.connecting, {
|
|
302
|
+
color: theme.muted
|
|
303
|
+
}], children: "Connecting to Web Builder\u2026" }) : null
|
|
304
|
+
] })
|
|
305
|
+
] });
|
|
306
|
+
}
|
|
307
|
+
const styles = StyleSheet.create({
|
|
308
|
+
fill: {
|
|
309
|
+
flex: 1
|
|
310
|
+
},
|
|
311
|
+
list: {
|
|
312
|
+
paddingHorizontal: 16,
|
|
313
|
+
paddingTop: 16,
|
|
314
|
+
paddingBottom: 12,
|
|
315
|
+
gap: 18,
|
|
316
|
+
flexGrow: 1
|
|
317
|
+
},
|
|
318
|
+
userRow: {
|
|
319
|
+
alignItems: "flex-end"
|
|
320
|
+
},
|
|
321
|
+
userBubble: {
|
|
322
|
+
maxWidth: "86%",
|
|
323
|
+
paddingHorizontal: 14,
|
|
324
|
+
paddingVertical: 10,
|
|
325
|
+
borderRadius: 20,
|
|
326
|
+
borderBottomRightRadius: 6
|
|
327
|
+
},
|
|
328
|
+
userText: {
|
|
329
|
+
fontSize: 16,
|
|
330
|
+
lineHeight: 22
|
|
331
|
+
},
|
|
332
|
+
agentTurn: {
|
|
333
|
+
gap: 8
|
|
334
|
+
},
|
|
335
|
+
agentHead: {
|
|
336
|
+
flexDirection: "row",
|
|
337
|
+
alignItems: "center",
|
|
338
|
+
gap: 8
|
|
339
|
+
},
|
|
340
|
+
agentMark: {
|
|
341
|
+
width: 24,
|
|
342
|
+
height: 24,
|
|
343
|
+
borderRadius: 8,
|
|
344
|
+
alignItems: "center",
|
|
345
|
+
justifyContent: "center"
|
|
346
|
+
},
|
|
347
|
+
agentName: {
|
|
348
|
+
fontSize: 14,
|
|
349
|
+
fontWeight: "700"
|
|
350
|
+
},
|
|
351
|
+
working: {
|
|
352
|
+
flexDirection: "row",
|
|
353
|
+
alignItems: "center",
|
|
354
|
+
gap: 10,
|
|
355
|
+
alignSelf: "flex-start",
|
|
356
|
+
maxWidth: "100%",
|
|
357
|
+
paddingHorizontal: 14,
|
|
358
|
+
paddingVertical: 10,
|
|
359
|
+
borderRadius: 14,
|
|
360
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
361
|
+
},
|
|
362
|
+
workingText: {
|
|
363
|
+
flexShrink: 1,
|
|
364
|
+
fontSize: 14,
|
|
365
|
+
fontWeight: "600"
|
|
366
|
+
},
|
|
367
|
+
workingTime: {
|
|
368
|
+
fontSize: 13,
|
|
369
|
+
fontVariant: ["tabular-nums"]
|
|
370
|
+
},
|
|
371
|
+
site: {
|
|
372
|
+
borderRadius: 22,
|
|
373
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
374
|
+
overflow: "hidden",
|
|
375
|
+
shadowOpacity: 0.06,
|
|
376
|
+
shadowRadius: 14,
|
|
377
|
+
shadowOffset: {
|
|
378
|
+
width: 0,
|
|
379
|
+
height: 4
|
|
380
|
+
},
|
|
381
|
+
elevation: 2
|
|
382
|
+
},
|
|
383
|
+
siteHead: {
|
|
384
|
+
flexDirection: "row",
|
|
385
|
+
alignItems: "center",
|
|
386
|
+
gap: 14,
|
|
387
|
+
padding: 16
|
|
388
|
+
},
|
|
389
|
+
siteGlobe: {
|
|
390
|
+
width: 48,
|
|
391
|
+
height: 48,
|
|
392
|
+
borderRadius: 14,
|
|
393
|
+
alignItems: "center",
|
|
394
|
+
justifyContent: "center"
|
|
395
|
+
},
|
|
396
|
+
siteHeadText: {
|
|
397
|
+
flex: 1,
|
|
398
|
+
gap: 2
|
|
399
|
+
},
|
|
400
|
+
siteTitle: {
|
|
401
|
+
fontSize: 18,
|
|
402
|
+
fontWeight: "700",
|
|
403
|
+
letterSpacing: -0.2
|
|
404
|
+
},
|
|
405
|
+
siteStatus: {
|
|
406
|
+
fontSize: 14
|
|
407
|
+
},
|
|
408
|
+
siteView: {
|
|
409
|
+
height: 240,
|
|
410
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
411
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
412
|
+
overflow: "hidden"
|
|
413
|
+
},
|
|
414
|
+
siteWeb: {
|
|
415
|
+
flex: 1,
|
|
416
|
+
backgroundColor: "transparent"
|
|
417
|
+
},
|
|
418
|
+
hidden: {
|
|
419
|
+
opacity: 0
|
|
420
|
+
},
|
|
421
|
+
siteLoading: __spreadProps(__spreadValues({}, StyleSheet.absoluteFillObject), {
|
|
422
|
+
alignItems: "center",
|
|
423
|
+
justifyContent: "center",
|
|
424
|
+
gap: 8
|
|
425
|
+
}),
|
|
426
|
+
siteLoadingText: {
|
|
427
|
+
fontSize: 13
|
|
428
|
+
},
|
|
429
|
+
siteBusy: {
|
|
430
|
+
position: "absolute",
|
|
431
|
+
top: 10,
|
|
432
|
+
right: 10,
|
|
433
|
+
flexDirection: "row",
|
|
434
|
+
alignItems: "center",
|
|
435
|
+
gap: 6,
|
|
436
|
+
paddingHorizontal: 10,
|
|
437
|
+
paddingVertical: 6,
|
|
438
|
+
borderRadius: 999
|
|
439
|
+
},
|
|
440
|
+
siteBusyText: {
|
|
441
|
+
fontSize: 12,
|
|
442
|
+
fontWeight: "600"
|
|
443
|
+
},
|
|
444
|
+
siteFoot: {
|
|
445
|
+
flexDirection: "row",
|
|
446
|
+
gap: 10,
|
|
447
|
+
padding: 14
|
|
448
|
+
},
|
|
449
|
+
siteBtn: {
|
|
450
|
+
flex: 1,
|
|
451
|
+
height: 46,
|
|
452
|
+
borderRadius: 23,
|
|
453
|
+
alignItems: "center",
|
|
454
|
+
justifyContent: "center"
|
|
455
|
+
},
|
|
456
|
+
siteBtnText: {
|
|
457
|
+
fontSize: 16,
|
|
458
|
+
fontWeight: "700"
|
|
459
|
+
},
|
|
460
|
+
disabled: {
|
|
461
|
+
opacity: 0.35
|
|
462
|
+
},
|
|
463
|
+
empty: {
|
|
464
|
+
flex: 1,
|
|
465
|
+
alignItems: "center",
|
|
466
|
+
justifyContent: "center",
|
|
467
|
+
paddingHorizontal: 32,
|
|
468
|
+
gap: 8
|
|
469
|
+
},
|
|
470
|
+
emptyMark: {
|
|
471
|
+
width: 56,
|
|
472
|
+
height: 56,
|
|
473
|
+
borderRadius: 18,
|
|
474
|
+
alignItems: "center",
|
|
475
|
+
justifyContent: "center",
|
|
476
|
+
marginBottom: 6
|
|
477
|
+
},
|
|
478
|
+
emptyTitle: {
|
|
479
|
+
fontSize: 18,
|
|
480
|
+
fontWeight: "700",
|
|
481
|
+
textAlign: "center"
|
|
482
|
+
},
|
|
483
|
+
emptyBody: {
|
|
484
|
+
fontSize: 14,
|
|
485
|
+
lineHeight: 20,
|
|
486
|
+
textAlign: "center"
|
|
487
|
+
},
|
|
488
|
+
suggestions: {
|
|
489
|
+
flexDirection: "row",
|
|
490
|
+
flexWrap: "wrap",
|
|
491
|
+
gap: 8,
|
|
492
|
+
paddingHorizontal: 16,
|
|
493
|
+
paddingBottom: 8
|
|
494
|
+
},
|
|
495
|
+
suggestion: {
|
|
496
|
+
paddingHorizontal: 14,
|
|
497
|
+
paddingVertical: 8,
|
|
498
|
+
borderRadius: 999,
|
|
499
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
500
|
+
},
|
|
501
|
+
suggestionText: {
|
|
502
|
+
fontSize: 14,
|
|
503
|
+
fontWeight: "500"
|
|
504
|
+
},
|
|
505
|
+
error: {
|
|
506
|
+
flexDirection: "row",
|
|
507
|
+
alignItems: "flex-start",
|
|
508
|
+
gap: 8,
|
|
509
|
+
marginHorizontal: 16,
|
|
510
|
+
marginBottom: 8,
|
|
511
|
+
paddingHorizontal: 12,
|
|
512
|
+
paddingVertical: 10,
|
|
513
|
+
borderRadius: 12
|
|
514
|
+
},
|
|
515
|
+
errorText: {
|
|
516
|
+
flex: 1,
|
|
517
|
+
fontSize: 13,
|
|
518
|
+
lineHeight: 18
|
|
519
|
+
},
|
|
520
|
+
composerDock: {
|
|
521
|
+
paddingHorizontal: 14,
|
|
522
|
+
paddingTop: 8
|
|
523
|
+
},
|
|
524
|
+
composer: {
|
|
525
|
+
flexDirection: "row",
|
|
526
|
+
alignItems: "flex-end",
|
|
527
|
+
gap: 8,
|
|
528
|
+
minHeight: 58,
|
|
529
|
+
borderRadius: 29,
|
|
530
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
531
|
+
paddingLeft: 18,
|
|
532
|
+
paddingRight: 8,
|
|
533
|
+
paddingVertical: 8,
|
|
534
|
+
shadowOpacity: 0.1,
|
|
535
|
+
shadowRadius: 18,
|
|
536
|
+
shadowOffset: {
|
|
537
|
+
width: 0,
|
|
538
|
+
height: 6
|
|
539
|
+
},
|
|
540
|
+
elevation: 6
|
|
541
|
+
},
|
|
542
|
+
jump: {
|
|
543
|
+
position: "absolute",
|
|
544
|
+
right: 16,
|
|
545
|
+
bottom: 104,
|
|
546
|
+
width: 44,
|
|
547
|
+
height: 44,
|
|
548
|
+
borderRadius: 22,
|
|
549
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
550
|
+
alignItems: "center",
|
|
551
|
+
justifyContent: "center",
|
|
552
|
+
shadowOpacity: 0.12,
|
|
553
|
+
shadowRadius: 10,
|
|
554
|
+
shadowOffset: {
|
|
555
|
+
width: 0,
|
|
556
|
+
height: 4
|
|
557
|
+
},
|
|
558
|
+
elevation: 4
|
|
559
|
+
},
|
|
560
|
+
input: {
|
|
561
|
+
flex: 1,
|
|
562
|
+
fontSize: 17,
|
|
563
|
+
lineHeight: 22,
|
|
564
|
+
maxHeight: 120,
|
|
565
|
+
paddingTop: 10,
|
|
566
|
+
paddingBottom: 10
|
|
567
|
+
},
|
|
568
|
+
send: {
|
|
569
|
+
width: 42,
|
|
570
|
+
height: 42,
|
|
571
|
+
borderRadius: 21,
|
|
572
|
+
alignItems: "center",
|
|
573
|
+
justifyContent: "center"
|
|
574
|
+
},
|
|
575
|
+
connecting: {
|
|
576
|
+
fontSize: 12,
|
|
577
|
+
textAlign: "center",
|
|
578
|
+
marginTop: 6
|
|
579
|
+
}
|
|
580
|
+
});export{ProjectChat};//# sourceMappingURL=ProjectChat.js.map
|