@vvedantb/native-ui 0.37.2 → 0.39.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/README.md +8 -7
- package/dist/Avatar.jsx +22 -19
- package/dist/BottomSheetContainer.jsx +0 -6
- package/dist/BulkActionBar.jsx +0 -24
- package/dist/Button.jsx +92 -116
- package/dist/Card.jsx +56 -50
- package/dist/ColorSwatches.jsx +0 -6
- package/dist/Dialog.jsx +0 -12
- package/dist/DropdownMenu.jsx +0 -10
- package/dist/EmptyState.jsx +0 -3
- package/dist/ExpoWebRoot.jsx +0 -6
- package/dist/Field.jsx +0 -17
- package/dist/FloatingSurface.jsx +95 -80
- package/dist/FloatingTabBar.jsx +0 -23
- package/dist/IconButton.jsx +0 -1
- package/dist/LoadingState.jsx +0 -6
- package/dist/PasswordInput.jsx +0 -15
- package/dist/PillTabs.jsx +39 -36
- package/dist/SearchInput.jsx +0 -13
- package/dist/SectionLabel.jsx +0 -1
- package/dist/SharedTransition.jsx +0 -3
- package/dist/Skeleton.jsx +0 -2
- package/dist/Spinner.jsx +0 -2
- package/dist/StatusDot.jsx +0 -5
- package/dist/Switch.jsx +32 -22
- package/dist/Tabs.jsx +27 -26
- package/dist/Textarea.jsx +0 -1
- package/dist/ThemeToggle.jsx +0 -1
- package/dist/Toast.jsx +80 -91
- package/dist/UpdateChecker.jsx +0 -1
- package/dist/ai/activity-question.jsx +0 -6
- package/dist/ai/activity-step-label.js +0 -6
- package/dist/ai/activity-step-types.js +0 -4
- package/dist/ai/activity-tasks-utils.js +0 -17
- package/dist/ai/activity-timeline.js +0 -8
- package/dist/ai/attachments.jsx +0 -2
- package/dist/ai/chain-of-thought.jsx +0 -3
- package/dist/ai/chat-text.js +0 -1
- package/dist/ai/chat-thread.jsx +0 -1
- package/dist/ai/choice-question.jsx +0 -10
- package/dist/ai/code-block.jsx +0 -31
- package/dist/ai/collapsible.jsx +0 -14
- package/dist/ai/conversation-context.js +0 -3
- package/dist/ai/conversation.jsx +2 -48
- package/dist/ai/file-chip.jsx +0 -2
- package/dist/ai/icon-button.jsx +0 -8
- package/dist/ai/index.js +0 -5
- package/dist/ai/message-context-menu.jsx +0 -7
- package/dist/ai/message.jsx +0 -21
- package/dist/ai/prompt-input-menu.jsx +0 -3
- package/dist/ai/prompt-input.jsx +0 -27
- package/dist/ai/response-text.jsx +0 -6
- package/dist/ai/sources.jsx +0 -1
- package/dist/ai/suggestion.jsx +0 -1
- package/dist/ai/trace.jsx +0 -11
- package/dist/ai/unified-diff.jsx +0 -4
- package/dist/app-root/AuthGroupGate.jsx +65 -0
- package/dist/app-root/SsoCallbackScreen.jsx +97 -0
- package/dist/app-root/fonts.js +88 -0
- package/dist/app-root/index.js +3 -0
- package/dist/auth/AuthScreen.jsx +250 -77
- package/dist/auth/GoogleSignInButton.jsx +0 -3
- package/dist/auth/SecondFactorScreen.jsx +18 -14
- package/dist/auth/SignInScreen.jsx +40 -34
- package/dist/auth/authErrors.js +0 -4
- package/dist/auth/clerkCore3.js +0 -7
- package/dist/auth/index.js +0 -4
- package/dist/auth/totp.js +0 -2
- package/dist/brand/GoogleMark.jsx +0 -1
- package/dist/brand/ProviderIcon.jsx +0 -2
- package/dist/brand/index.js +0 -3
- package/dist/brand/svg.js +0 -6
- package/dist/configureTheme.js +0 -9
- package/dist/controlStyles.js +0 -14
- package/dist/crash/LastCrashDialog.jsx +56 -0
- package/dist/crash/lastCrash.js +192 -0
- package/dist/entries/ai.js +0 -3
- package/dist/entries/ambient.js +0 -2
- package/dist/entries/app-root.js +1 -0
- package/dist/entries/auth.js +0 -4
- package/dist/entries/bottom-sheet.js +0 -2
- package/dist/entries/brand.js +0 -1
- package/dist/entries/button.js +0 -1
- package/dist/entries/crash.js +2 -0
- package/dist/entries/date-time.js +0 -2
- package/dist/entries/expo-router.js +0 -3
- package/dist/entries/expo-web-root.js +0 -2
- package/dist/entries/floating.js +0 -2
- package/dist/entries/generative-ui.js +0 -4
- package/dist/entries/gesture-handler.js +0 -3
- package/dist/entries/keyboard-controller.js +0 -3
- package/dist/entries/layout.js +0 -2
- package/dist/entries/markdown.js +0 -3
- package/dist/entries/marketing.js +0 -1
- package/dist/entries/page-title.js +0 -5
- package/dist/entries/password-input.js +0 -2
- package/dist/entries/paste-input.js +0 -3
- package/dist/entries/primitives.js +0 -6
- package/dist/entries/search-input.js +0 -2
- package/dist/entries/tab-bar.js +0 -2
- package/dist/entries/theme.js +4 -2
- package/dist/entries/toast.js +0 -3
- package/dist/entries/video.js +0 -2
- package/dist/entries/webview.js +0 -2
- package/dist/examples/AiChatGallery.jsx +0 -11
- package/dist/examples/ParityGallery.jsx +0 -12
- package/dist/floating.js +0 -8
- package/dist/generative-ui/GenerativeUiPanel.jsx +0 -2
- package/dist/generative-ui/components.jsx +0 -8
- package/dist/glass.js +55 -0
- package/dist/glassBlur.jsx +0 -12
- package/dist/highlight.js +0 -26
- package/dist/index.js +4 -2
- package/dist/loadingGrid.js +0 -13
- package/dist/markdown/Markdown.jsx +0 -59
- package/dist/markdown/MarkdownTable.jsx +0 -18
- package/dist/markdown/tableText.js +0 -5
- package/dist/marketing/UpgradeToProCard.jsx +0 -5
- package/dist/marketing/pricing.js +0 -3
- package/dist/media/ImageGallery.jsx +0 -16
- package/dist/media/imageZoom.js +0 -4
- package/dist/media/zoom-image-gesture.jsx +0 -8
- package/dist/media/zoomImage.js +0 -3
- package/dist/motion.js +0 -3
- package/dist/neutralTheme.js +158 -0
- package/dist/pagerSwipe.js +0 -16
- package/dist/palette.js +0 -10
- package/dist/primitives/button.jsx +0 -5
- package/dist/primitives/icon.jsx +0 -4
- package/dist/primitives/keyboard-controller.jsx +0 -27
- package/dist/primitives/native-only-animated-view.jsx +0 -5
- package/dist/primitives/overlay.jsx +0 -2
- package/dist/primitives/pager-gesture.jsx +3 -29
- package/dist/primitives/paste-input.jsx +0 -5
- package/dist/primitives/select.jsx +0 -10
- package/dist/primitives/sheet-drag.jsx +0 -3
- package/dist/primitives/sheet-gesture.jsx +0 -8
- package/dist/primitives/swipe-row-gesture.jsx +3 -45
- package/dist/primitives/text.jsx +0 -5
- package/dist/primitives/toast-drag-gesture.jsx +4 -24
- package/dist/primitives/web-click-guard.js +0 -3
- package/dist/primitives/window-layer.jsx +0 -14
- package/dist/push.js +0 -6
- package/dist/relativeTime.js +0 -13
- package/dist/settings/MoreFromProjectV.jsx +0 -5
- package/dist/settings/ThemeModePicker.jsx +2 -9
- package/dist/settings/projectVMobileApps.js +1 -6
- package/dist/sheetDrag.js +0 -10
- package/dist/swipeRow.js +0 -15
- package/dist/tabBarRoutes.js +0 -4
- package/dist/tabIndicator.js +0 -4
- package/dist/tailwind-preset.cjs +0 -54
- package/dist/tailwind-preset.d.cts +0 -8
- package/dist/theme.jsx +29 -21
- package/dist/themeModeStore.js +62 -0
- package/dist/themeModes.js +9 -0
- package/dist/toastChrome.js +0 -6
- package/dist/toastDrag.js +0 -14
- package/dist/toastStore.js +0 -4
- package/dist/updateCheck.js +0 -7
- package/dist/video/InlineVideo.jsx +0 -2
- package/dist/webview/htmlView.js +0 -5
- package/package.json +47 -19
- package/src/ArtifactList.tsx +0 -2
- package/src/Avatar.tsx +3 -3
- package/src/Badge.tsx +0 -1
- package/src/BottomSheetContainer.tsx +0 -11
- package/src/BulkActionBar.tsx +0 -66
- package/src/Button.tsx +4 -40
- package/src/CaptureButton.tsx +0 -1
- package/src/Card.tsx +3 -15
- package/src/Checkbox.tsx +0 -2
- package/src/ColorSwatches.tsx +0 -9
- package/src/ConfirmDialog.tsx +0 -7
- package/src/DateTimeField.tsx +0 -5
- package/src/Dialog.tsx +0 -27
- package/src/DividedList.tsx +0 -1
- package/src/DropdownMenu.tsx +0 -51
- package/src/EmptyState.tsx +0 -5
- package/src/ExpoWebRoot.tsx +0 -10
- package/src/Field.tsx +0 -14
- package/src/FloatingFAB.tsx +0 -3
- package/src/FloatingSurface.tsx +11 -8
- package/src/FloatingTabBar.tsx +0 -25
- package/src/IconButton.tsx +0 -5
- package/src/Input.tsx +0 -1
- package/src/Label.tsx +0 -1
- package/src/LabeledSwitchRow.tsx +0 -2
- package/src/ListRow.tsx +0 -12
- package/src/LoadingState.tsx +0 -12
- package/src/MenuSheet.tsx +0 -2
- package/src/PageIndicator.tsx +0 -2
- package/src/PageTitle.tsx +0 -15
- package/src/Pager.tsx +0 -9
- package/src/PasswordInput.tsx +0 -24
- package/src/PillTabs.tsx +3 -11
- package/src/PinnedBotTile.tsx +0 -6
- package/src/Progress.tsx +0 -3
- package/src/ReactionRow.tsx +0 -8
- package/src/ScreenContainer.tsx +0 -4
- package/src/SearchInput.tsx +0 -25
- package/src/SectionLabel.tsx +0 -2
- package/src/Select.tsx +0 -6
- package/src/Separator.tsx +0 -2
- package/src/SharedTransition.tsx +0 -7
- package/src/Sheet.tsx +0 -3
- package/src/SheetRow.tsx +0 -12
- package/src/Skeleton.tsx +0 -10
- package/src/Spinner.tsx +0 -6
- package/src/StackPageHeader.tsx +0 -16
- package/src/StatGrid.tsx +0 -1
- package/src/StatusDot.tsx +0 -6
- package/src/SurfaceRow.tsx +0 -12
- package/src/SwipeableRow.tsx +0 -4
- package/src/Switch.tsx +3 -4
- package/src/Tabs.tsx +3 -27
- package/src/Textarea.tsx +0 -2
- package/src/ThemeToggle.tsx +0 -1
- package/src/Toast.tsx +3 -19
- package/src/UpdateChecker.tsx +0 -46
- package/src/ai/activity-question.tsx +0 -8
- package/src/ai/activity-step-detail.tsx +0 -5
- package/src/ai/activity-step-label.ts +0 -5
- package/src/ai/activity-step-types.ts +0 -24
- package/src/ai/activity-step.tsx +0 -4
- package/src/ai/activity-tasks-utils.ts +0 -13
- package/src/ai/activity-timeline.ts +0 -6
- package/src/ai/attachments.tsx +0 -13
- package/src/ai/chain-of-thought.tsx +0 -5
- package/src/ai/chat-jump-rail.tsx +0 -2
- package/src/ai/chat-text.ts +0 -1
- package/src/ai/chat-thread.tsx +0 -9
- package/src/ai/choice-question.tsx +0 -36
- package/src/ai/code-block.tsx +0 -52
- package/src/ai/collapsible.tsx +0 -12
- package/src/ai/conversation-context.ts +0 -14
- package/src/ai/conversation.tsx +0 -58
- package/src/ai/file-chip.tsx +0 -1
- package/src/ai/icon-button.tsx +0 -17
- package/src/ai/index.ts +0 -5
- package/src/ai/message-action-sheet.tsx +0 -8
- package/src/ai/message-context-menu.tsx +0 -22
- package/src/ai/message-quote.tsx +0 -4
- package/src/ai/message.tsx +0 -66
- package/src/ai/prompt-input-menu.tsx +0 -19
- package/src/ai/prompt-input.tsx +0 -97
- package/src/ai/reasoning.tsx +0 -6
- package/src/ai/reply-quote-chip.tsx +0 -5
- package/src/ai/response-text.tsx +0 -8
- package/src/ai/shimmer.tsx +0 -2
- package/src/ai/sources.tsx +0 -3
- package/src/ai/subagent-cards.tsx +0 -13
- package/src/ai/suggestion.tsx +0 -4
- package/src/ai/tool-approval-card.tsx +0 -14
- package/src/ai/trace.tsx +0 -23
- package/src/ai/unified-diff.tsx +0 -16
- package/src/ai/use-streaming-disclosure.ts +0 -4
- package/src/app-root/AuthGroupGate.tsx +38 -0
- package/src/app-root/SsoCallbackScreen.tsx +52 -0
- package/src/app-root/fonts.ts +53 -0
- package/src/app-root/index.ts +6 -0
- package/src/auth/AccountScreens.tsx +0 -16
- package/src/auth/AuthProviders.tsx +0 -13
- package/src/auth/AuthScreen.tsx +95 -6
- package/src/auth/GoogleSignInButton.tsx +0 -12
- package/src/auth/SecondFactorScreen.tsx +17 -15
- package/src/auth/SignInScreen.tsx +103 -105
- package/src/auth/authErrors.ts +0 -6
- package/src/auth/clerkCore3.ts +0 -6
- package/src/auth/index.ts +0 -4
- package/src/auth/totp.ts +0 -13
- package/src/brand/AppIcons.tsx +0 -6
- package/src/brand/AppMark.tsx +0 -5
- package/src/brand/AppWordmark.tsx +0 -7
- package/src/brand/GoogleMark.tsx +0 -4
- package/src/brand/ProviderIcon.tsx +0 -6
- package/src/brand/familyApps.ts +0 -2
- package/src/brand/index.ts +0 -3
- package/src/brand/svg.ts +0 -9
- package/src/configureTheme.ts +0 -10
- package/src/controlStyles.ts +0 -12
- package/src/crash/LastCrashDialog.tsx +36 -0
- package/src/crash/lastCrash.ts +218 -0
- package/src/entries/ai.ts +0 -3
- package/src/entries/ambient.ts +0 -2
- package/src/entries/app-root.ts +1 -0
- package/src/entries/auth.ts +0 -4
- package/src/entries/bottom-sheet.ts +0 -2
- package/src/entries/brand.ts +0 -1
- package/src/entries/button.ts +0 -1
- package/src/entries/crash.ts +13 -0
- package/src/entries/date-time.ts +0 -2
- package/src/entries/expo-router.ts +0 -3
- package/src/entries/expo-web-root.ts +0 -2
- package/src/entries/floating.ts +0 -2
- package/src/entries/generative-ui.ts +0 -4
- package/src/entries/gesture-handler.ts +0 -3
- package/src/entries/keyboard-controller.ts +0 -3
- package/src/entries/layout.ts +0 -2
- package/src/entries/markdown.ts +0 -3
- package/src/entries/marketing.ts +0 -1
- package/src/entries/page-title.ts +0 -5
- package/src/entries/password-input.ts +0 -2
- package/src/entries/paste-input.ts +0 -3
- package/src/entries/primitives.ts +0 -6
- package/src/entries/search-input.ts +0 -2
- package/src/entries/tab-bar.ts +0 -2
- package/src/entries/theme.ts +8 -2
- package/src/entries/toast.ts +0 -3
- package/src/entries/video.ts +0 -2
- package/src/entries/webview.ts +0 -2
- package/src/examples/AiChatGallery.tsx +0 -11
- package/src/examples/ParityGallery.tsx +0 -25
- package/src/floating.ts +0 -6
- package/src/generative-ui/GenerativeUiPanel.tsx +0 -15
- package/src/generative-ui/components.tsx +0 -9
- package/src/generative-ui/context.ts +0 -2
- package/src/glass.ts +31 -0
- package/src/glassBlur.tsx +0 -15
- package/src/highlight.ts +1 -21
- package/src/index.ts +7 -2
- package/src/loadingGrid.ts +0 -12
- package/src/markdown/Markdown.tsx +0 -71
- package/src/markdown/MarkdownTable.tsx +0 -23
- package/src/markdown/tableText.ts +0 -3
- package/src/marketing/PricingModal.tsx +0 -13
- package/src/marketing/UpgradeToProCard.tsx +0 -14
- package/src/marketing/pricing.ts +0 -12
- package/src/media/ImageGallery.tsx +0 -18
- package/src/media/MediaCard.tsx +0 -8
- package/src/media/imageZoom.ts +0 -4
- package/src/media/zoom-image-gesture.tsx +0 -9
- package/src/media/zoomImage.ts +0 -5
- package/src/motion.ts +0 -3
- package/src/neutralTheme.ts +127 -0
- package/src/pagerSwipe.ts +0 -13
- package/src/palette.ts +0 -10
- package/src/pressScale.ts +0 -7
- package/src/primitives/button.tsx +0 -4
- package/src/primitives/card.tsx +0 -1
- package/src/primitives/icon.tsx +0 -2
- package/src/primitives/input.tsx +0 -4
- package/src/primitives/keyboard-controller.tsx +0 -25
- package/src/primitives/keyboard-parts.tsx +0 -27
- package/src/primitives/native-only-animated-view.tsx +0 -5
- package/src/primitives/overlay.tsx +0 -25
- package/src/primitives/pager-gesture.tsx +0 -20
- package/src/primitives/paste-input.tsx +0 -4
- package/src/primitives/paste-parts.tsx +0 -1
- package/src/primitives/select.tsx +0 -18
- package/src/primitives/sheet-drag.tsx +0 -19
- package/src/primitives/sheet-gesture.tsx +0 -22
- package/src/primitives/swipe-row-gesture.tsx +0 -33
- package/src/primitives/switch.tsx +0 -4
- package/src/primitives/text.tsx +0 -4
- package/src/primitives/toast-drag-gesture.tsx +0 -13
- package/src/primitives/web-click-guard.ts +0 -2
- package/src/primitives/window-layer.tsx +0 -18
- package/src/push.ts +0 -15
- package/src/relativeTime.ts +0 -21
- package/src/router/RouterStackPageHeader.tsx +0 -1
- package/src/settings/MoreFromProjectV.tsx +0 -8
- package/src/settings/SettingsEmptyState.tsx +0 -2
- package/src/settings/SettingsSection.tsx +0 -3
- package/src/settings/SettingsToggleRow.tsx +0 -4
- package/src/settings/ThemeModePicker.tsx +2 -16
- package/src/settings/projectVMobileApps.ts +0 -8
- package/src/sheetDrag.ts +0 -9
- package/src/swipeRow.ts +0 -23
- package/src/tabBarRoutes.ts +0 -13
- package/src/tabIndicator.ts +0 -5
- package/src/tailwind-preset.cjs +0 -54
- package/src/tailwind-preset.d.cts +0 -8
- package/src/theme.tsx +11 -2
- package/src/themeModeStore.ts +85 -0
- package/src/themeModes.ts +10 -0
- package/src/toastChrome.ts +0 -6
- package/src/toastDrag.ts +0 -13
- package/src/toastStore.ts +0 -7
- package/src/updateCheck.ts +0 -15
- package/src/video/InlineVideo.tsx +0 -5
- package/src/webview/HtmlView.tsx +0 -23
- package/src/webview/HtmlView.web.tsx +0 -1
- package/src/webview/htmlView.ts +0 -5
- package/types/prism-react-renderer.d.ts +22 -0
package/src/ai/prompt-input.tsx
CHANGED
|
@@ -27,18 +27,11 @@ export type PromptInputSubmitProps = {
|
|
|
27
27
|
status?: ChatStatus;
|
|
28
28
|
onSubmit?: () => void;
|
|
29
29
|
onStop?: () => void;
|
|
30
|
-
/** Whether there is something to send. Default `true`. */
|
|
31
30
|
canSubmit?: boolean;
|
|
32
|
-
/** Default `sm` (32). `md` is 36, the `pill` composer's send button. */
|
|
33
31
|
size?: ChatIconButtonSize;
|
|
34
32
|
testID?: string;
|
|
35
33
|
};
|
|
36
34
|
|
|
37
|
-
// The web `PromptInputSubmit` and `PromptInputButton` keep `shape="rounded"`
|
|
38
|
-
// (`rounded-lg`, 16) as field addons. At the 32 `icon-sm` size 16 is half the
|
|
39
|
-
// side, so the web draws a circle. These stay pills: the same circle at 32, and
|
|
40
|
-
// still a circle at 44 with larger text, where 16 would draw a rounded square.
|
|
41
|
-
|
|
42
35
|
/**
|
|
43
36
|
* Send, or stop while the AI answers: the web `default` `icon-sm` button
|
|
44
37
|
* (32, round, slop to 44). Send is an up arrow on the primary fill, faded by
|
|
@@ -104,36 +97,21 @@ export const PROMPT_INPUT_CHIP = {
|
|
|
104
97
|
chevronSize: 12,
|
|
105
98
|
chevronOpacity: 0.6,
|
|
106
99
|
suffixOpacity: 0.7,
|
|
107
|
-
/** The narrowest label worth drawing: about two characters and the ellipsis at `text-sm` (2em). */
|
|
108
100
|
labelMinWidth: 28,
|
|
109
|
-
/** `size="touch"`: 36 on screen, 4 slop above and below, so a 44 bar holds its whole target. */
|
|
110
101
|
touchHeight: 36,
|
|
111
102
|
} as const;
|
|
112
103
|
|
|
113
104
|
export type PromptInputChipProps = {
|
|
114
|
-
/** Before the label: a `PROMPT_INPUT_CHIP.iconSize` (14) mark, such as `ProviderIcon` or a Tabler icon. */
|
|
115
105
|
icon?: ReactNode;
|
|
116
106
|
label: string;
|
|
117
|
-
/** After the label, " · " between, at 70% of `color`: the web trigger suffix (the reasoning level). */
|
|
118
107
|
suffix?: string;
|
|
119
|
-
/** After the label in medium weight with tabular figures, such as a saved count. */
|
|
120
108
|
count?: number;
|
|
121
|
-
/** The chevron after the label. Default `true`. */
|
|
122
109
|
chevron?: boolean;
|
|
123
|
-
/** Label weight. Default `medium`, the web trigger; a quieter footer passes `normal`. */
|
|
124
110
|
weight?: "normal" | "medium";
|
|
125
|
-
/** Text, chevron and Tabler icon colour. Default `tokens.color.muted`, the web `text-muted-foreground`. */
|
|
126
111
|
color?: string;
|
|
127
|
-
/** Default: the label, then the suffix and count. */
|
|
128
112
|
accessibilityLabel?: string;
|
|
129
|
-
/** Whether the menu it opens is open, for VoiceOver and TalkBack. */
|
|
130
113
|
expanded?: boolean;
|
|
131
114
|
disabled?: boolean;
|
|
132
|
-
/**
|
|
133
|
-
* Default `sm`, the web trigger: 28 high, slop to 44. `touch` has no web
|
|
134
|
-
* twin: 36 high, for a phone bar that is 44 itself, so the slop stays
|
|
135
|
-
* inside the bar and never reaches the field above.
|
|
136
|
-
*/
|
|
137
115
|
size?: "sm" | "touch";
|
|
138
116
|
onPress?: () => void;
|
|
139
117
|
testID?: string;
|
|
@@ -167,10 +145,6 @@ export function PromptInputChip({
|
|
|
167
145
|
const scheme = useScheme();
|
|
168
146
|
const pressed = usePressFeedback();
|
|
169
147
|
const { fontScale } = useWindowDimensions();
|
|
170
|
-
// Whether the label slot is wide enough to read. Hiding it only sets the
|
|
171
|
-
// opacity, so the layout and the next `onLayout` width stay the same: the
|
|
172
|
-
// state changes once per threshold crossing, never in a layout loop, and a
|
|
173
|
-
// wider slot later shows the label again.
|
|
174
148
|
const [readable, setReadable] = useState(true);
|
|
175
149
|
const tint = color ?? tokens.color.muted[scheme];
|
|
176
150
|
const text = [sizeStyle("text-sm"), { color: tint }];
|
|
@@ -183,10 +157,8 @@ export function PromptInputChip({
|
|
|
183
157
|
accessibilityState={{ disabled, expanded }}
|
|
184
158
|
disabled={disabled}
|
|
185
159
|
onPress={onPress}
|
|
186
|
-
// Slop only above and below: chips sit side by side, so the width stays theirs.
|
|
187
160
|
hitSlop={touchSlop(MIN_TOUCH_TARGET, height)}
|
|
188
161
|
className={cn("min-w-0 shrink flex-row items-center", pressed, disabled && "opacity-50")}
|
|
189
|
-
// `minHeight`, so a larger system font size can still grow it.
|
|
190
162
|
style={{
|
|
191
163
|
minHeight: height,
|
|
192
164
|
paddingHorizontal: PROMPT_INPUT_CHIP.paddingX,
|
|
@@ -194,7 +166,6 @@ export function PromptInputChip({
|
|
|
194
166
|
borderRadius: PROMPT_INPUT_CHIP.radius,
|
|
195
167
|
}}
|
|
196
168
|
>
|
|
197
|
-
{/* Held whole: in a squeezed chip only the label gives up width. */}
|
|
198
169
|
{icon ? <View className="shrink-0">{icon}</View> : null}
|
|
199
170
|
<Text
|
|
200
171
|
numberOfLines={1}
|
|
@@ -228,85 +199,33 @@ export type PromptInputProps = {
|
|
|
228
199
|
value?: string;
|
|
229
200
|
defaultValue?: string;
|
|
230
201
|
onChangeText?: (text: string) => void;
|
|
231
|
-
/** Called with the trimmed text when Send is pressed. The field then clears. */
|
|
232
202
|
onSubmit: (text: string) => void;
|
|
233
203
|
status?: ChatStatus;
|
|
234
204
|
onStop?: () => void;
|
|
235
|
-
/** Default "What would you like to know?", as on the web. */
|
|
236
205
|
placeholder?: string;
|
|
237
|
-
/** Names the field for VoiceOver and TalkBack. Default "Message". */
|
|
238
206
|
accessibilityLabel?: string;
|
|
239
|
-
/**
|
|
240
|
-
* A pending reply above the field and above `header`: a `ReplyQuoteChip`.
|
|
241
|
-
* Clear it in the app with the chip's `onDismiss`. A `ReplyQuoteChip` as
|
|
242
|
-
* `header` works as well, beside any attachments.
|
|
243
|
-
*/
|
|
244
207
|
replyTo?: ReactNode;
|
|
245
|
-
/** Above the field, such as `Attachments`. */
|
|
246
208
|
header?: ReactNode;
|
|
247
|
-
/** Before the send button, such as `PromptInputButton`s. */
|
|
248
209
|
toolbar?: ReactNode;
|
|
249
|
-
/**
|
|
250
|
-
* Under the field, inside the keyboard lift and above the bottom inset: a
|
|
251
|
-
* row of `PromptInputChip`s, as the bar under Eva's web composer.
|
|
252
|
-
*/
|
|
253
210
|
footer?: ReactNode;
|
|
254
|
-
/**
|
|
255
|
-
* Right above the field, the field's width and 6 clear of it, inside the
|
|
256
|
-
* keyboard lift: a `PromptInputMenu`, the web `@` / `/` picker. Pass it only
|
|
257
|
-
* while the picker is open.
|
|
258
|
-
*/
|
|
259
211
|
menu?: ReactNode;
|
|
260
|
-
/**
|
|
261
|
-
* Images pasted into the field (long-press Paste, or the keyboard's image
|
|
262
|
-
* insert), as `file://` URIs. Needs `PasteInputProvider` from
|
|
263
|
-
* `@vvedantb/native-ui/paste-input`; without it a field takes text only.
|
|
264
|
-
*/
|
|
265
212
|
onPasteImages?: (uris: string[]) => void;
|
|
266
|
-
/**
|
|
267
|
-
* `stacked` (default): the field over a footer of tools and send, the web
|
|
268
|
-
* `PromptInput`. `inline`: one row, as the web `Composer layout="inline"`
|
|
269
|
-
* (Eva's chat): `leading`, the field, `toolbar`, then send, in a 20-radius
|
|
270
|
-
* field with `p-1.5`, 44 high on one line.
|
|
271
|
-
*/
|
|
272
213
|
layout?: "stacked" | "inline";
|
|
273
|
-
/**
|
|
274
|
-
* `inline` only. `rounded` (default): the web `Composer` field, radius 20.
|
|
275
|
-
* `pill`: Eva's web chat composer (`h-12 rounded-full py-1`): 48 high on one
|
|
276
|
-
* line, a 36 send button and a `text-sm` (14 / 20) field 36 high; it keeps
|
|
277
|
-
* radius 24 as it grows. Give the + a filled `variant="secondary"`, as Eva.
|
|
278
|
-
*/
|
|
279
214
|
shape?: "rounded" | "pill";
|
|
280
|
-
/** `inline` only: before the field, such as a + (attach) `PromptInputButton`. */
|
|
281
215
|
leading?: ReactNode;
|
|
282
216
|
disabled?: boolean;
|
|
283
|
-
/** Pad the bottom safe-area inset (home indicator). Default `true`; turn it off when a tab bar below already does. */
|
|
284
217
|
safeBottom?: boolean;
|
|
285
|
-
/** Height of anything above the screen's own top, such as a navigation header, for the keyboard lift. Default 0. */
|
|
286
218
|
keyboardVerticalOffset?: number;
|
|
287
219
|
className?: string;
|
|
288
220
|
testID?: string;
|
|
289
221
|
};
|
|
290
222
|
|
|
291
|
-
/** The web `Composer` inline radius, `rounded-[1.25rem]`. */
|
|
292
223
|
const INLINE_RADIUS = 20;
|
|
293
224
|
|
|
294
|
-
/**
|
|
295
|
-
* Eva's `pill` composer: 48 high on one line (border 1, then 5 around a 36
|
|
296
|
-
* field: the web `h-12 py-1` centres the 36 field and send button in 38),
|
|
297
|
-
* `pl-1.5` / `pr-1.5`, and radius 24 (`rounded-full` at 48). Its placeholder
|
|
298
|
-
* is the muted colour at 90% (`data-empty:before:text-muted-foreground/90`).
|
|
299
|
-
*/
|
|
300
225
|
const PILL = { radius: 24, paddingY: 5, paddingX: 6, lineHeight: 36, placeholderAlpha: 0.9 } as const;
|
|
301
226
|
|
|
302
|
-
/** The field grows to this height, then scrolls: about 6 lines of 24 (with `py-2.5`), and about 8 of `text-xl` with larger text. */
|
|
303
227
|
const MAX_FIELD_HEIGHT = { regular: 160, larger: 240 } as const;
|
|
304
228
|
|
|
305
|
-
/**
|
|
306
|
-
* React Native Web draws a multiline field as a `textarea` with the HTML
|
|
307
|
-
* default of 2 rows, and the auto-grow keeps that height. One row there; on
|
|
308
|
-
* native, `numberOfLines` would lock the line count on Android, so none.
|
|
309
|
-
*/
|
|
310
229
|
const ONE_ROW = Platform.OS === "web" ? 1 : undefined;
|
|
311
230
|
|
|
312
231
|
/**
|
|
@@ -348,29 +267,22 @@ export function PromptInput({
|
|
|
348
267
|
const insets = useSafeAreaInsets();
|
|
349
268
|
const lifted = useContext(KeyboardLiftContext);
|
|
350
269
|
const paste = usePasteParts();
|
|
351
|
-
// The field inside the paste target when an app takes pasted images; it then fills the target.
|
|
352
270
|
const pasteTarget = paste && onPasteImages ? paste.Target : null;
|
|
353
271
|
const [text, setText] = useControllableState({ value, defaultValue, onChange: onChangeText });
|
|
354
272
|
const message = text.trim();
|
|
355
273
|
const canSubmit = message.length > 0 && !disabled && !isGenerating(status);
|
|
356
274
|
const bottom = safeBottom ? insets.bottom : 0;
|
|
357
|
-
// The field grows with its content up to `maxHeight`, then scrolls. A fixed
|
|
358
|
-
// `numberOfLines` would lock the line count on Android, so neither layout sets it.
|
|
359
275
|
const [contentHeight, setContentHeight] = useState(0);
|
|
360
276
|
const maxHeight = largerText ? MAX_FIELD_HEIGHT.larger : MAX_FIELD_HEIGHT.regular;
|
|
361
277
|
const growStyle = contentHeight > 0 ? { height: Math.min(contentHeight, maxHeight) } : null;
|
|
362
278
|
const scrollEnabled = contentHeight > maxHeight;
|
|
363
279
|
const pill = layout === "inline" && shape === "pill";
|
|
364
|
-
// Inline: the web `Composer` `text-sm leading-6` (Eva's pill: `leading-5`).
|
|
365
|
-
// Stacked: the web `PromptInput` `Textarea`, `text-base` below `sm`. Larger text is `text-xl`.
|
|
366
280
|
const fieldText = largerText
|
|
367
281
|
? sizeStyle("text-xl")
|
|
368
282
|
: layout === "inline"
|
|
369
283
|
? { fontSize: 14, lineHeight: pill ? 20 : 24 }
|
|
370
284
|
: sizeStyle("text-base");
|
|
371
285
|
|
|
372
|
-
// An empty field drops its measured height and is one line again: on the web
|
|
373
|
-
// a `textarea` only reports a taller height, never a shorter one.
|
|
374
286
|
const changeText = (next: string) => {
|
|
375
287
|
setText(next);
|
|
376
288
|
if (next === "") setContentHeight(0);
|
|
@@ -389,10 +301,8 @@ export function PromptInput({
|
|
|
389
301
|
className={cn("pt-2", className)}
|
|
390
302
|
style={{ paddingBottom: bottom + 8, paddingLeft: insets.left + 12, paddingRight: insets.right + 12 }}
|
|
391
303
|
>
|
|
392
|
-
{/* The web panel picker's 6 gap (`POPUP_GAP`) above the field. */}
|
|
393
304
|
{menu ? <View className="mb-1.5">{menu}</View> : null}
|
|
394
305
|
{layout === "inline" ? (
|
|
395
|
-
// Web `Composer` inline: `rounded-[1.25rem]` and a `p-1.5` row, items at the bottom as the field grows.
|
|
396
306
|
<View className="border" style={[fieldStyle(scheme), { borderRadius: pill ? PILL.radius : INLINE_RADIUS }]}>
|
|
397
307
|
{replyTo ? <View className="px-1.5 pt-1.5">{replyTo}</View> : null}
|
|
398
308
|
{header ? <View className="flex-row flex-wrap gap-1 px-1.5 pt-1.5">{header}</View> : null}
|
|
@@ -401,7 +311,6 @@ export function PromptInput({
|
|
|
401
311
|
style={pill ? { paddingVertical: PILL.paddingY, paddingHorizontal: PILL.paddingX } : null}
|
|
402
312
|
>
|
|
403
313
|
{leading ? (
|
|
404
|
-
// In the pill, centred on the 36 line, as the web `items-center` row.
|
|
405
314
|
<View className="shrink-0 flex-row items-center gap-1" style={pill ? { minHeight: PILL.lineHeight } : null}>
|
|
406
315
|
{leading}
|
|
407
316
|
</View>
|
|
@@ -422,7 +331,6 @@ export function PromptInput({
|
|
|
422
331
|
scrollEnabled={scrollEnabled}
|
|
423
332
|
onContentSizeChange={(e) => setContentHeight(e.nativeEvent.contentSize.height)}
|
|
424
333
|
className={cn(
|
|
425
|
-
// In the row the field grows across; in a paste target, the target does and the field fills it.
|
|
426
334
|
pasteTarget ? "border-0 text-sm font-instrument-sans" : "flex-1 border-0 text-sm font-instrument-sans",
|
|
427
335
|
pill ? "min-h-9 px-1 py-2" : "min-h-8 px-2 py-1",
|
|
428
336
|
largerText && "min-h-11 py-2 text-xl font-instrument-sans-medium",
|
|
@@ -455,7 +363,6 @@ export function PromptInput({
|
|
|
455
363
|
<View className="border" style={fieldStyle(scheme)}>
|
|
456
364
|
{replyTo ? <View className="px-2 pt-2">{replyTo}</View> : null}
|
|
457
365
|
{header ? <View className="flex-row flex-wrap gap-1 px-2 pt-2">{header}</View> : null}
|
|
458
|
-
{/* The `Textarea` field without its `numberOfLines` (default 4), which on Android sets the line count: this one starts at one line and grows. */}
|
|
459
366
|
<PasteTarget target={pasteTarget} onPasteImages={onPasteImages}>
|
|
460
367
|
<FieldInput
|
|
461
368
|
testID={testID ? `${testID}-input` : undefined}
|
|
@@ -498,8 +405,6 @@ export function PromptInput({
|
|
|
498
405
|
if (lifted) return composer;
|
|
499
406
|
return (
|
|
500
407
|
<KeyboardAvoidingView
|
|
501
|
-
// The keyboard covers the home indicator, so the inset padded below is
|
|
502
|
-
// taken off the lift: the composer sits right on the keyboard.
|
|
503
408
|
keyboardVerticalOffset={keyboardVerticalOffset - bottom}
|
|
504
409
|
>
|
|
505
410
|
{composer}
|
|
@@ -507,10 +412,8 @@ export function PromptInput({
|
|
|
507
412
|
);
|
|
508
413
|
}
|
|
509
414
|
|
|
510
|
-
/** In the inline row the paste target takes the field's place: it grows across, and the field fills it. */
|
|
511
415
|
const PASTE_TARGET_INLINE = { flex: 1, minWidth: 0 };
|
|
512
416
|
|
|
513
|
-
/** The field inside the app's paste target (`PasteInputProvider`), or the field alone. */
|
|
514
417
|
function PasteTarget({
|
|
515
418
|
target: Target,
|
|
516
419
|
onPasteImages,
|
package/src/ai/reasoning.tsx
CHANGED
|
@@ -24,7 +24,6 @@ type ReasoningContextValue = {
|
|
|
24
24
|
isStreaming: boolean;
|
|
25
25
|
isOpen: boolean;
|
|
26
26
|
setIsOpen: (open: boolean) => void;
|
|
27
|
-
/** Whole seconds the reasoning streamed for, or `undefined` before it is known. */
|
|
28
27
|
duration: number | undefined;
|
|
29
28
|
};
|
|
30
29
|
|
|
@@ -41,10 +40,8 @@ const AUTO_CLOSE_DELAY_MS = 1000;
|
|
|
41
40
|
export type ReasoningProps = Omit<CollapsibleProps, "open" | "defaultOpen" | "onOpenChange"> & {
|
|
42
41
|
isStreaming?: boolean;
|
|
43
42
|
open?: boolean;
|
|
44
|
-
/** Default: open while streaming. `false` keeps it shut when streaming starts, as on the web. */
|
|
45
43
|
defaultOpen?: boolean;
|
|
46
44
|
onOpenChange?: (open: boolean) => void;
|
|
47
|
-
/** Seconds, when the app knows them (a reloaded thread). Default: timed from `isStreaming`. */
|
|
48
45
|
duration?: number;
|
|
49
46
|
};
|
|
50
47
|
|
|
@@ -72,8 +69,6 @@ export function Reasoning({
|
|
|
72
69
|
const [closeDue, setCloseDue] = useState(false);
|
|
73
70
|
const startedAt = useRef<number | null>(isStreaming ? Date.now() : null);
|
|
74
71
|
|
|
75
|
-
// Runs when the stream starts or stops, not on every open change, so a
|
|
76
|
-
// reader's own close mid-stream holds.
|
|
77
72
|
useEffect(() => {
|
|
78
73
|
if (isStreaming) {
|
|
79
74
|
if (startedAt.current === null) startedAt.current = Date.now();
|
|
@@ -122,7 +117,6 @@ export function reasoningMessage(isStreaming: boolean, duration?: number): strin
|
|
|
122
117
|
}
|
|
123
118
|
|
|
124
119
|
export type ReasoningTriggerProps = CollapsibleTriggerProps & {
|
|
125
|
-
/** Replaces `reasoningMessage`. A string, as it is also the accessibility label. */
|
|
126
120
|
getThinkingMessage?: (isStreaming: boolean, duration?: number) => string;
|
|
127
121
|
};
|
|
128
122
|
|
|
@@ -9,15 +9,10 @@ import { useScheme } from "../useScheme";
|
|
|
9
9
|
import { chatTextSize } from "./chat-text";
|
|
10
10
|
|
|
11
11
|
export type ReplyQuoteChipProps = {
|
|
12
|
-
/** Who wrote the message being replied to. */
|
|
13
12
|
author: string;
|
|
14
|
-
/** Its text. Shown on up to two lines. */
|
|
15
13
|
text: string;
|
|
16
|
-
/** Called when the X is pressed. Clear the reply in the app. */
|
|
17
14
|
onDismiss?: () => void;
|
|
18
|
-
/** Default "Replying to {author}". */
|
|
19
15
|
accessibilityLabel?: string;
|
|
20
|
-
/** Names the X button. Default "Dismiss reply quote". */
|
|
21
16
|
dismissLabel?: string;
|
|
22
17
|
className?: string;
|
|
23
18
|
testID?: string;
|
package/src/ai/response-text.tsx
CHANGED
|
@@ -6,12 +6,6 @@ import { useLargerText } from "../theme";
|
|
|
6
6
|
import { useScheme } from "../useScheme";
|
|
7
7
|
import { chatTextSize, type ChatTextKind } from "./chat-text";
|
|
8
8
|
|
|
9
|
-
// Markdown stub. The web renders replies with Streamdown; native-ui has no
|
|
10
|
-
// markdown peer, so `ResponseText` draws the text as it is, newlines kept.
|
|
11
|
-
// An app that wants markdown can render one of these in its place:
|
|
12
|
-
// `react-native-markdown-display`, `@ronradtke/react-native-markdown-display`
|
|
13
|
-
// (a maintained fork) or `react-native-marked`.
|
|
14
|
-
|
|
15
9
|
/**
|
|
16
10
|
* The text colour `MessageContent` hands down: React Native text does not
|
|
17
11
|
* inherit a colour from its parent view, as web text does from `color`.
|
|
@@ -20,9 +14,7 @@ export const ChatTextColorContext = createContext<string | undefined>(undefined)
|
|
|
20
14
|
|
|
21
15
|
export type ResponseTextProps = Omit<TextProps, "children"> & {
|
|
22
16
|
children: string;
|
|
23
|
-
/** Default: the enclosing `MessageContent` colour, else the foreground. */
|
|
24
17
|
tone?: "foreground" | "muted";
|
|
25
|
-
/** Default `"body"` (16, `text-xl` with larger text). See `chatTextSize`. */
|
|
26
18
|
size?: ChatTextKind;
|
|
27
19
|
className?: string;
|
|
28
20
|
};
|
package/src/ai/shimmer.tsx
CHANGED
|
@@ -22,9 +22,7 @@ export const SHIMMER_LOW_OPACITY = 0.45;
|
|
|
22
22
|
|
|
23
23
|
export type ShimmerProps = {
|
|
24
24
|
children: string;
|
|
25
|
-
/** Seconds for one pass, as on the web. Default 2. */
|
|
26
25
|
duration?: number;
|
|
27
|
-
/** Default `"small"` (14, `text-lg` with larger text). */
|
|
28
26
|
size?: ChatTextKind;
|
|
29
27
|
numberOfLines?: number;
|
|
30
28
|
className?: string;
|
package/src/ai/sources.tsx
CHANGED
|
@@ -61,14 +61,11 @@ export function SourcesContent({ className, ...props }: ViewProps & { className?
|
|
|
61
61
|
|
|
62
62
|
export type SourceProps = {
|
|
63
63
|
href: string;
|
|
64
|
-
/** Shown, and read, in place of the address. */
|
|
65
64
|
title?: string;
|
|
66
|
-
/** Default: `Linking.openURL(href)`, the system browser or the app that owns the link. */
|
|
67
65
|
onPress?: (href: string) => void;
|
|
68
66
|
testID?: string;
|
|
69
67
|
};
|
|
70
68
|
|
|
71
|
-
/** A `text-sm` line with the web `py-2`: 36 high. The slop brings it to 44. */
|
|
72
69
|
const ROW_HEIGHT = 36;
|
|
73
70
|
|
|
74
71
|
/**
|
|
@@ -66,18 +66,12 @@ function StatusPill({ status, testID }: { status: SubagentStatus; testID: string
|
|
|
66
66
|
export type SubagentRunCardProps = {
|
|
67
67
|
title: string;
|
|
68
68
|
status: SubagentStatus;
|
|
69
|
-
/** Whole seconds the run has taken. Shown as "12s" or "1m 5s". */
|
|
70
69
|
elapsedSeconds?: number;
|
|
71
|
-
/** Shows a Cancel button while `status` is `queued` or `running`. */
|
|
72
70
|
onCancel?: () => void;
|
|
73
|
-
/** Muted detail under the title, such as step or progress text. */
|
|
74
71
|
statusLine?: string;
|
|
75
|
-
/** Error text, in the danger colour. */
|
|
76
72
|
error?: string;
|
|
77
|
-
/** Replaces the robot icon. While `queued` or `running` a spinner shows instead. */
|
|
78
73
|
avatar?: ReactNode;
|
|
79
74
|
className?: string;
|
|
80
|
-
/** Default `subagent-run-card`. Parts add `-status`, `-elapsed` and `-cancel`. */
|
|
81
75
|
testID?: string;
|
|
82
76
|
};
|
|
83
77
|
|
|
@@ -166,23 +160,16 @@ export type SubagentHandoff = {
|
|
|
166
160
|
|
|
167
161
|
export type SubagentResultCardProps = {
|
|
168
162
|
title: string;
|
|
169
|
-
/** The short result, always shown. */
|
|
170
163
|
summary: string;
|
|
171
|
-
/** The full result, shown when the card is open. No fold without it. */
|
|
172
164
|
detail?: string;
|
|
173
|
-
/** Shows the warning note that an approval waits in another chat. */
|
|
174
165
|
approvalPending?: boolean;
|
|
175
|
-
/** Name for `Approval pending in {name}'s chat.` Default "the other bot". */
|
|
176
166
|
approvalPendingIn?: string;
|
|
177
|
-
/** Proposed actions, listed under "Proposed actions". */
|
|
178
167
|
handoffs?: readonly SubagentHandoff[];
|
|
179
|
-
/** A leading avatar beside the title. */
|
|
180
168
|
avatar?: ReactNode;
|
|
181
169
|
defaultOpen?: boolean;
|
|
182
170
|
open?: boolean;
|
|
183
171
|
onOpenChange?: (open: boolean) => void;
|
|
184
172
|
className?: string;
|
|
185
|
-
/** Default `subagent-result-card`. Parts add `-trigger` and `-detail`. */
|
|
186
173
|
testID?: string;
|
|
187
174
|
};
|
|
188
175
|
|
package/src/ai/suggestion.tsx
CHANGED
|
@@ -10,10 +10,8 @@ import { chatTextSize } from "./chat-text";
|
|
|
10
10
|
import { usePressed } from "../usePressed";
|
|
11
11
|
|
|
12
12
|
export type SuggestionsProps = {
|
|
13
|
-
/** `horizontal` (default) scrolls one row of chips; `vertical` stacks them full width. */
|
|
14
13
|
orientation?: "horizontal" | "vertical";
|
|
15
14
|
className?: string;
|
|
16
|
-
/** Classes for the horizontal row inside the scroll view, after the web `gap-2 px-1`. */
|
|
17
15
|
contentContainerClassName?: string;
|
|
18
16
|
children?: ReactNode;
|
|
19
17
|
};
|
|
@@ -47,13 +45,11 @@ export function Suggestions({
|
|
|
47
45
|
export type SuggestionProps = {
|
|
48
46
|
suggestion: string;
|
|
49
47
|
onPress?: (suggestion: string) => void;
|
|
50
|
-
/** Replaces the text; the accessibility label stays `suggestion`. */
|
|
51
48
|
children?: string;
|
|
52
49
|
disabled?: boolean;
|
|
53
50
|
testID?: string;
|
|
54
51
|
};
|
|
55
52
|
|
|
56
|
-
/** A `text-sm` line with the web `py-1.5`: 32 high. The slop brings it to 44. */
|
|
57
53
|
const CHIP_HEIGHT = 32;
|
|
58
54
|
|
|
59
55
|
/**
|
|
@@ -39,32 +39,20 @@ export function changedDraftEdits(
|
|
|
39
39
|
export type ToolDecision = "approve" | "deny" | "edit";
|
|
40
40
|
|
|
41
41
|
export type ToolApprovalCardProps = {
|
|
42
|
-
/** The tool the model wants to run. */
|
|
43
42
|
toolName: string;
|
|
44
|
-
/** The arguments, as a short string or an object. Shown cut to `ARGS_MAX_CHARS`. */
|
|
45
43
|
args?: string | Record<string, unknown>;
|
|
46
|
-
/** Called with the choice. */
|
|
47
44
|
onDecide?: (decision: ToolDecision, edits?: DraftEdit[]) => void;
|
|
48
|
-
/** True while the app sends the decision: the buttons are off and the card says so. */
|
|
49
45
|
pending?: boolean;
|
|
50
|
-
/** Turns the buttons off without the pending state. */
|
|
51
46
|
disabled?: boolean;
|
|
52
47
|
approveLabel?: string;
|
|
53
48
|
denyLabel?: string;
|
|
54
|
-
/** The tool server. The meta line reads `via {server}`, else `built-in tool`. */
|
|
55
49
|
server?: string;
|
|
56
|
-
/** Appends "queued while you were away" to the meta line. */
|
|
57
50
|
routineMode?: boolean;
|
|
58
|
-
/** Expiry text the app has formatted. Appends `Expires {expiresLabel}` to the meta line. */
|
|
59
51
|
expiresLabel?: string;
|
|
60
|
-
/** Shows a `Target: {target}` line. */
|
|
61
52
|
target?: string;
|
|
62
|
-
/** Replaces the default meta line. */
|
|
63
53
|
meta?: ReactNode;
|
|
64
|
-
/** Extra content under the meta line (above the target and args). */
|
|
65
54
|
chrome?: ReactNode;
|
|
66
55
|
className?: string;
|
|
67
|
-
/** Default `tool-approval-card`. The buttons add `-approve`, `-deny` and `-edit`. */
|
|
68
56
|
testID?: string;
|
|
69
57
|
};
|
|
70
58
|
|
|
@@ -92,7 +80,6 @@ type BaseProps = ToolApprovalCardProps & {
|
|
|
92
80
|
allowEdit?: boolean;
|
|
93
81
|
editLabel?: string;
|
|
94
82
|
heading: string;
|
|
95
|
-
/** Text between the source and the expiry in the default meta line. */
|
|
96
83
|
metaNote?: string;
|
|
97
84
|
fields?: readonly DraftField[];
|
|
98
85
|
};
|
|
@@ -283,7 +270,6 @@ export function ToolApprovalCard(props: ToolApprovalCardProps) {
|
|
|
283
270
|
|
|
284
271
|
export type ToolDraftCardProps = ToolApprovalCardProps & {
|
|
285
272
|
editLabel?: string;
|
|
286
|
-
/** The draft fields. Shows them as a preview and, under Edit, as inputs. Without them Edit reports `"edit"`. */
|
|
287
273
|
fields?: readonly DraftField[];
|
|
288
274
|
};
|
|
289
275
|
|
package/src/ai/trace.tsx
CHANGED
|
@@ -20,11 +20,6 @@ import {
|
|
|
20
20
|
import { ResponseText } from "./response-text";
|
|
21
21
|
import { Shimmer } from "./shimmer";
|
|
22
22
|
|
|
23
|
-
// One agent step as one line: icon, title, optional faded description and an
|
|
24
|
-
// optional fold. Reasoning, tool calls, grouped calls and to-dos can all
|
|
25
|
-
// render through these parts, as on the web (`trace.tsx`). The web icon
|
|
26
|
-
// crossfade (`iconKey`) is not ported: the icon swaps at once.
|
|
27
|
-
|
|
28
23
|
export type AgentTraceStatus = "running" | "error" | "pending";
|
|
29
24
|
|
|
30
25
|
/** Text and icon colour of a line: muted, or the danger colour for an error (web `text-destructive`). */
|
|
@@ -32,7 +27,6 @@ export function traceLineColor(status: AgentTraceStatus | undefined, scheme: "li
|
|
|
32
27
|
return status === "error" ? palette.danger[scheme] : tokens.color.muted[scheme];
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
// Native text and icons do not inherit a colour, so the line hands its own down.
|
|
36
30
|
const TraceLineColorContext = createContext<string | undefined>(undefined);
|
|
37
31
|
|
|
38
32
|
function useTraceColor() {
|
|
@@ -69,9 +63,7 @@ export function AgentTraceLine({ status, className, style, ...props }: AgentTrac
|
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
export type AgentTraceIconProps = {
|
|
72
|
-
/** A Tabler icon, drawn 16 (20 with larger text) in the line colour. */
|
|
73
66
|
icon?: ComponentType<IconProps>;
|
|
74
|
-
/** Anything else in the 16 box, such as a `Spinner size="sm"`. */
|
|
75
67
|
children?: ReactNode;
|
|
76
68
|
className?: string;
|
|
77
69
|
};
|
|
@@ -95,7 +87,6 @@ export function AgentTraceIcon({ icon: Icon, children, className }: AgentTraceIc
|
|
|
95
87
|
|
|
96
88
|
export type AgentTraceTitleProps = {
|
|
97
89
|
children: string;
|
|
98
|
-
/** Pulse the title while the step runs (`Shimmer`). */
|
|
99
90
|
shimmer?: boolean;
|
|
100
91
|
className?: string;
|
|
101
92
|
};
|
|
@@ -145,18 +136,11 @@ export function AgentTraceCollapsible({ className, ...props }: CollapsibleProps)
|
|
|
145
136
|
}
|
|
146
137
|
|
|
147
138
|
export type AgentTraceCollapsibleTriggerProps = CollapsibleTriggerProps & {
|
|
148
|
-
/**
|
|
149
|
-
* Controls of their own (a pressable `FileChip`), drawn after the line and
|
|
150
|
-
* outside the trigger, as on the web, so each keeps its own press and
|
|
151
|
-
* accessibility label.
|
|
152
|
-
*/
|
|
153
139
|
trailing?: ReactNode;
|
|
154
140
|
};
|
|
155
141
|
|
|
156
|
-
/** No slop: the 28 high line is the whole target, as trace lines stack with no gap. */
|
|
157
142
|
const LINE_SLOP = { top: 0, bottom: 0, left: 0, right: 0 } as const;
|
|
158
143
|
|
|
159
|
-
/** The chevron's slop: 4 back toward the line, 14 on past it (a 34 wide target), none above or below. */
|
|
160
144
|
const CHEVRON_SLOP = { top: 0, bottom: 0, left: 4, right: 14 } as const;
|
|
161
145
|
|
|
162
146
|
/**
|
|
@@ -195,7 +179,6 @@ export function AgentTraceCollapsibleTrigger({
|
|
|
195
179
|
{children}
|
|
196
180
|
</CollapsibleTrigger>
|
|
197
181
|
{trailing}
|
|
198
|
-
{/* The chevron toggles too, as the web overlay makes the whole line press. The trigger already names the fold. */}
|
|
199
182
|
<Pressable
|
|
200
183
|
accessible={false}
|
|
201
184
|
importantForAccessibility="no-hide-descendants"
|
|
@@ -250,19 +233,13 @@ export function AgentTraceCollapsibleContent({
|
|
|
250
233
|
}
|
|
251
234
|
|
|
252
235
|
export type AgentTraceFoldProps = Omit<CollapsibleProps, "children"> & {
|
|
253
|
-
/** The settled turn's steps, shown in an `AgentTrace` when open. */
|
|
254
236
|
children: ReactNode;
|
|
255
237
|
} & (
|
|
256
238
|
| {
|
|
257
|
-
/** How long the turn ran, in seconds. The title reads "Worked for 1m 5s" (`formatElapsed`). */
|
|
258
239
|
seconds: number;
|
|
259
240
|
duration?: never;
|
|
260
241
|
}
|
|
261
242
|
| {
|
|
262
|
-
/**
|
|
263
|
-
* The duration already formatted, as the web `ActivityTasks` `duration`:
|
|
264
|
-
* the title reads "Worked for " and this. For an app's own formatter.
|
|
265
|
-
*/
|
|
266
243
|
duration: string;
|
|
267
244
|
seconds?: never;
|
|
268
245
|
}
|
package/src/ai/unified-diff.tsx
CHANGED
|
@@ -11,11 +11,8 @@ export type UnifiedDiffLine =
|
|
|
11
11
|
| { readonly kind: "hunk"; readonly text: string }
|
|
12
12
|
| {
|
|
13
13
|
readonly kind: "added" | "removed" | "context";
|
|
14
|
-
/** The line's content, without its `+`/`-`/space marker. */
|
|
15
14
|
readonly text: string;
|
|
16
|
-
/** Null for an added line. */
|
|
17
15
|
readonly oldLine: number | null;
|
|
18
|
-
/** Null for a removed line. */
|
|
19
16
|
readonly newLine: number | null;
|
|
20
17
|
};
|
|
21
18
|
|
|
@@ -25,13 +22,11 @@ export type UnifiedDiffLine =
|
|
|
25
22
|
*/
|
|
26
23
|
export const UNIFIED_DIFF = { fontSize: 14, lineHeight: 22, gutterPadding: 8, digitWidth: 8.5 } as const;
|
|
27
24
|
|
|
28
|
-
/** Larger text steps the code up as `chatTextSize("small")` does (`text-lg`), keeping the 22/14 leading. */
|
|
29
25
|
const LARGER_FONT_SIZE = 18;
|
|
30
26
|
|
|
31
27
|
/** Web `bg-emerald-500/10` and `text-emerald-700` (dark `text-emerald-300`): edit and diff added lines. */
|
|
32
28
|
export const EMERALD = { fill: "#10b981", light: "#047857", dark: "#6ee7b7" } as const;
|
|
33
29
|
|
|
34
|
-
/** Web `text-emerald-600` (dark `text-emerald-400`), the `+n` of a diff stat. */
|
|
35
30
|
const ADDED_TEXT = { light: "#059669", dark: "#34d399" } as const;
|
|
36
31
|
|
|
37
32
|
const SIGN = { added: "+", removed: "-", context: " " } as const;
|
|
@@ -40,15 +35,8 @@ const TABULAR: TextStyle = { fontVariant: ["tabular-nums"] };
|
|
|
40
35
|
|
|
41
36
|
export type UnifiedDiffProps = {
|
|
42
37
|
lines: ReadonlyArray<UnifiedDiffLine>;
|
|
43
|
-
/**
|
|
44
|
-
* Makes each code row (not a hunk header) a button: a tap calls this with
|
|
45
|
-
* the row's index in `lines`. The code is then not selectable, so a tap
|
|
46
|
-
* always lands.
|
|
47
|
-
*/
|
|
48
38
|
onLinePress?: (index: number) => void;
|
|
49
|
-
/** What a row's button does, for a screen reader (`accessibilityHint`). */
|
|
50
39
|
linePressHint?: string;
|
|
51
|
-
/** Indexes in `lines` of the rows to mark, such as those with a comment: their gutter fills. */
|
|
52
40
|
markedLines?: ReadonlySet<number>;
|
|
53
41
|
className?: string;
|
|
54
42
|
};
|
|
@@ -134,9 +122,6 @@ export function UnifiedDiff({ lines, onLinePress, linePressHint, markedLines, cl
|
|
|
134
122
|
accessibilityRole="button"
|
|
135
123
|
accessibilityLabel={`Line ${number ?? ""}`}
|
|
136
124
|
accessibilityHint={linePressHint}
|
|
137
|
-
// No slop: rows tile the diff edge to edge, so any slop would take
|
|
138
|
-
// the next line's taps. Each row is a full-width 22 high target,
|
|
139
|
-
// as dense as the code it holds.
|
|
140
125
|
hitSlop={0}
|
|
141
126
|
onPress={() => onLinePress(index)}
|
|
142
127
|
className="flex-row active:opacity-60"
|
|
@@ -154,7 +139,6 @@ export function UnifiedDiff({ lines, onLinePress, linePressHint, markedLines, cl
|
|
|
154
139
|
export type DiffStatProps = {
|
|
155
140
|
additions: number;
|
|
156
141
|
deletions: number;
|
|
157
|
-
/** Drop a side that is zero, so a pure addition reads `+2`, not `+2 −0`. */
|
|
158
142
|
hideZero?: boolean;
|
|
159
143
|
className?: string;
|
|
160
144
|
};
|
|
@@ -17,8 +17,6 @@ export function useStreamingDisclosure(isStreaming: boolean): {
|
|
|
17
17
|
const [wasStreaming, setWasStreaming] = useState(isStreaming);
|
|
18
18
|
const [closeDue, setCloseDue] = useState(false);
|
|
19
19
|
|
|
20
|
-
// Adjusting state while rendering, as on the web: no extra commit with the
|
|
21
|
-
// old open state.
|
|
22
20
|
if (isStreaming !== wasStreaming) {
|
|
23
21
|
setWasStreaming(isStreaming);
|
|
24
22
|
if (isStreaming) {
|
|
@@ -29,8 +27,6 @@ export function useStreamingDisclosure(isStreaming: boolean): {
|
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
// The close is a delayed reaction to the stream stopping, not to a press:
|
|
33
|
-
// only a timer can express "one second later".
|
|
34
30
|
useEffect(() => {
|
|
35
31
|
if (!closeDue) return;
|
|
36
32
|
const timer = setTimeout(() => {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useAuth } from "@clerk/expo";
|
|
2
|
+
import { Redirect, type Href } from "expo-router";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
export type AuthGroupGateProps = {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
waitForLoaded?: boolean;
|
|
8
|
+
loading?: ReactNode;
|
|
9
|
+
treatPendingAsSignedOut?: boolean;
|
|
10
|
+
signedInHref?: Href;
|
|
11
|
+
withAnchor?: boolean;
|
|
12
|
+
skipSignedInRedirect?: boolean;
|
|
13
|
+
previewHref?: Href;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The layout of an `(auth)` route group: waits for Clerk when asked, sends signed-in
|
|
18
|
+
* users on, and renders the auth stack otherwise. The app passes its own loading UI.
|
|
19
|
+
*/
|
|
20
|
+
export function AuthGroupGate({
|
|
21
|
+
children,
|
|
22
|
+
waitForLoaded = true,
|
|
23
|
+
loading = null,
|
|
24
|
+
treatPendingAsSignedOut,
|
|
25
|
+
signedInHref = "/",
|
|
26
|
+
withAnchor,
|
|
27
|
+
skipSignedInRedirect = false,
|
|
28
|
+
previewHref,
|
|
29
|
+
}: AuthGroupGateProps) {
|
|
30
|
+
const { isSignedIn, isLoaded } = useAuth(
|
|
31
|
+
treatPendingAsSignedOut === undefined ? undefined : { treatPendingAsSignedOut },
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
if (waitForLoaded && !isLoaded) return loading;
|
|
35
|
+
if (isSignedIn && !skipSignedInRedirect) return <Redirect href={signedInHref} withAnchor={withAnchor} />;
|
|
36
|
+
if (previewHref) return <Redirect href={previewHref} />;
|
|
37
|
+
return children;
|
|
38
|
+
}
|