@vvedantb/native-ui 0.38.0 → 0.40.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.
Files changed (373) hide show
  1. package/dist/Avatar.jsx +22 -19
  2. package/dist/BottomSheetContainer.jsx +0 -6
  3. package/dist/BulkActionBar.jsx +0 -24
  4. package/dist/Button.jsx +92 -116
  5. package/dist/Card.jsx +56 -50
  6. package/dist/ColorSwatches.jsx +0 -6
  7. package/dist/Dialog.jsx +0 -12
  8. package/dist/DropdownMenu.jsx +0 -10
  9. package/dist/EmptyState.jsx +0 -3
  10. package/dist/ExpoWebRoot.jsx +0 -6
  11. package/dist/Field.jsx +0 -17
  12. package/dist/FloatingSurface.jsx +95 -80
  13. package/dist/FloatingTabBar.jsx +0 -23
  14. package/dist/IconButton.jsx +0 -1
  15. package/dist/LoadingState.jsx +0 -6
  16. package/dist/PasswordInput.jsx +0 -15
  17. package/dist/PillTabs.jsx +39 -36
  18. package/dist/SearchInput.jsx +0 -13
  19. package/dist/SectionLabel.jsx +0 -1
  20. package/dist/SharedTransition.jsx +0 -3
  21. package/dist/Skeleton.jsx +0 -2
  22. package/dist/Spinner.jsx +0 -2
  23. package/dist/StatusDot.jsx +0 -5
  24. package/dist/Switch.jsx +32 -22
  25. package/dist/Tabs.jsx +27 -26
  26. package/dist/Textarea.jsx +0 -1
  27. package/dist/ThemeToggle.jsx +0 -1
  28. package/dist/Toast.jsx +80 -91
  29. package/dist/UpdateChecker.jsx +0 -1
  30. package/dist/ai/activity-question.jsx +0 -6
  31. package/dist/ai/activity-step-label.js +0 -6
  32. package/dist/ai/activity-step-types.js +0 -4
  33. package/dist/ai/activity-tasks-utils.js +0 -17
  34. package/dist/ai/activity-timeline.js +0 -8
  35. package/dist/ai/attachments.jsx +0 -2
  36. package/dist/ai/chain-of-thought.jsx +0 -3
  37. package/dist/ai/chat-text.js +2 -3
  38. package/dist/ai/chat-thread.jsx +0 -1
  39. package/dist/ai/choice-question.jsx +0 -10
  40. package/dist/ai/code-block.jsx +0 -31
  41. package/dist/ai/collapsible.jsx +0 -14
  42. package/dist/ai/conversation-context.js +0 -3
  43. package/dist/ai/conversation.jsx +2 -48
  44. package/dist/ai/file-chip.jsx +0 -2
  45. package/dist/ai/icon-button.jsx +10 -18
  46. package/dist/ai/index.js +0 -5
  47. package/dist/ai/message-context-menu.jsx +0 -7
  48. package/dist/ai/message.jsx +0 -21
  49. package/dist/ai/prompt-input-menu.jsx +0 -3
  50. package/dist/ai/prompt-input.jsx +2 -29
  51. package/dist/ai/response-text.jsx +0 -6
  52. package/dist/ai/sources.jsx +0 -1
  53. package/dist/ai/suggestion.jsx +0 -1
  54. package/dist/ai/trace.jsx +0 -11
  55. package/dist/ai/unified-diff.jsx +0 -4
  56. package/dist/auth/AuthScreen.jsx +0 -5
  57. package/dist/auth/GoogleSignInButton.jsx +0 -3
  58. package/dist/auth/SecondFactorScreen.jsx +0 -2
  59. package/dist/auth/SignInScreen.jsx +0 -17
  60. package/dist/auth/authErrors.js +0 -4
  61. package/dist/auth/clerkCore3.js +0 -7
  62. package/dist/auth/index.js +0 -4
  63. package/dist/auth/totp.js +0 -2
  64. package/dist/brand/GoogleMark.jsx +0 -1
  65. package/dist/brand/ProviderIcon.jsx +0 -2
  66. package/dist/brand/index.js +0 -3
  67. package/dist/brand/svg.js +0 -6
  68. package/dist/configureTheme.js +0 -9
  69. package/dist/controlStyles.js +0 -14
  70. package/dist/crash/lastCrash.js +3 -24
  71. package/dist/entries/ai.js +0 -3
  72. package/dist/entries/ambient.js +0 -2
  73. package/dist/entries/app-root.js +0 -5
  74. package/dist/entries/auth.js +0 -4
  75. package/dist/entries/bottom-sheet.js +0 -2
  76. package/dist/entries/brand.js +0 -1
  77. package/dist/entries/button.js +0 -1
  78. package/dist/entries/crash.js +0 -3
  79. package/dist/entries/date-time.js +0 -2
  80. package/dist/entries/expo-router.js +0 -3
  81. package/dist/entries/expo-web-root.js +0 -2
  82. package/dist/entries/floating.js +0 -2
  83. package/dist/entries/generative-ui.js +0 -4
  84. package/dist/entries/gesture-handler.js +0 -3
  85. package/dist/entries/keyboard-controller.js +0 -3
  86. package/dist/entries/layout.js +0 -2
  87. package/dist/entries/markdown.js +0 -3
  88. package/dist/entries/marketing.js +0 -1
  89. package/dist/entries/page-title.js +0 -5
  90. package/dist/entries/password-input.js +0 -2
  91. package/dist/entries/paste-input.js +0 -3
  92. package/dist/entries/primitives.js +0 -6
  93. package/dist/entries/search-input.js +0 -2
  94. package/dist/entries/tab-bar.js +0 -2
  95. package/dist/entries/theme.js +1 -2
  96. package/dist/entries/toast.js +0 -3
  97. package/dist/entries/video.js +0 -2
  98. package/dist/entries/webview.js +0 -2
  99. package/dist/examples/AiChatGallery.jsx +0 -11
  100. package/dist/examples/ParityGallery.jsx +0 -12
  101. package/dist/floating.js +0 -8
  102. package/dist/generative-ui/GenerativeUiPanel.jsx +0 -2
  103. package/dist/generative-ui/components.jsx +0 -8
  104. package/dist/glass.js +55 -0
  105. package/dist/glassBlur.jsx +0 -12
  106. package/dist/highlight.js +0 -26
  107. package/dist/index.js +1 -2
  108. package/dist/loadingGrid.js +0 -13
  109. package/dist/markdown/Markdown.jsx +0 -59
  110. package/dist/markdown/MarkdownTable.jsx +0 -18
  111. package/dist/markdown/tableText.js +0 -5
  112. package/dist/marketing/UpgradeToProCard.jsx +0 -5
  113. package/dist/marketing/pricing.js +0 -3
  114. package/dist/media/ImageGallery.jsx +0 -16
  115. package/dist/media/imageZoom.js +0 -4
  116. package/dist/media/zoom-image-gesture.jsx +0 -8
  117. package/dist/media/zoomImage.js +0 -3
  118. package/dist/motion.js +0 -3
  119. package/dist/neutralTheme.js +0 -5
  120. package/dist/pagerSwipe.js +0 -16
  121. package/dist/palette.js +0 -10
  122. package/dist/primitives/button.jsx +0 -5
  123. package/dist/primitives/keyboard-controller.jsx +0 -27
  124. package/dist/primitives/native-only-animated-view.jsx +0 -5
  125. package/dist/primitives/overlay.jsx +0 -2
  126. package/dist/primitives/pager-gesture.jsx +3 -29
  127. package/dist/primitives/paste-input.jsx +0 -5
  128. package/dist/primitives/select.jsx +0 -8
  129. package/dist/primitives/sheet-drag.jsx +0 -3
  130. package/dist/primitives/sheet-gesture.jsx +0 -8
  131. package/dist/primitives/swipe-row-gesture.jsx +3 -45
  132. package/dist/primitives/text.jsx +0 -5
  133. package/dist/primitives/toast-drag-gesture.jsx +4 -24
  134. package/dist/primitives/web-click-guard.js +0 -3
  135. package/dist/primitives/window-layer.jsx +0 -14
  136. package/dist/push.js +0 -6
  137. package/dist/relativeTime.js +0 -13
  138. package/dist/settings/MoreFromProjectV.jsx +0 -5
  139. package/dist/settings/ThemeModePicker.jsx +0 -4
  140. package/dist/settings/projectVMobileApps.js +1 -6
  141. package/dist/sheetDrag.js +0 -10
  142. package/dist/swipeRow.js +0 -15
  143. package/dist/tabBarRoutes.js +0 -4
  144. package/dist/tabIndicator.js +0 -4
  145. package/dist/tailwind-preset.cjs +0 -54
  146. package/dist/tailwind-preset.d.cts +0 -8
  147. package/dist/theme.jsx +29 -21
  148. package/dist/themeModeStore.js +0 -5
  149. package/dist/toastChrome.js +0 -6
  150. package/dist/toastDrag.js +0 -14
  151. package/dist/toastStore.js +0 -4
  152. package/dist/updateCheck.js +0 -7
  153. package/dist/video/InlineVideo.jsx +0 -2
  154. package/dist/webview/htmlView.js +0 -5
  155. package/package.json +3 -3
  156. package/src/ArtifactList.tsx +0 -2
  157. package/src/Avatar.tsx +3 -3
  158. package/src/Badge.tsx +0 -1
  159. package/src/BottomSheetContainer.tsx +0 -11
  160. package/src/BulkActionBar.tsx +0 -66
  161. package/src/Button.tsx +4 -40
  162. package/src/CaptureButton.tsx +0 -1
  163. package/src/Card.tsx +3 -15
  164. package/src/Checkbox.tsx +0 -2
  165. package/src/ColorSwatches.tsx +0 -9
  166. package/src/ConfirmDialog.tsx +0 -7
  167. package/src/DateTimeField.tsx +0 -5
  168. package/src/Dialog.tsx +0 -27
  169. package/src/DividedList.tsx +0 -1
  170. package/src/DropdownMenu.tsx +0 -51
  171. package/src/EmptyState.tsx +0 -5
  172. package/src/ExpoWebRoot.tsx +0 -10
  173. package/src/Field.tsx +0 -14
  174. package/src/FloatingFAB.tsx +0 -3
  175. package/src/FloatingSurface.tsx +11 -8
  176. package/src/FloatingTabBar.tsx +0 -25
  177. package/src/IconButton.tsx +0 -5
  178. package/src/Input.tsx +0 -1
  179. package/src/Label.tsx +0 -1
  180. package/src/LabeledSwitchRow.tsx +0 -2
  181. package/src/ListRow.tsx +0 -12
  182. package/src/LoadingState.tsx +0 -12
  183. package/src/MenuSheet.tsx +0 -2
  184. package/src/PageIndicator.tsx +0 -2
  185. package/src/PageTitle.tsx +0 -15
  186. package/src/Pager.tsx +0 -9
  187. package/src/PasswordInput.tsx +0 -24
  188. package/src/PillTabs.tsx +3 -11
  189. package/src/PinnedBotTile.tsx +0 -6
  190. package/src/Progress.tsx +0 -3
  191. package/src/ReactionRow.tsx +0 -8
  192. package/src/ScreenContainer.tsx +0 -4
  193. package/src/SearchInput.tsx +0 -25
  194. package/src/SectionLabel.tsx +0 -2
  195. package/src/Select.tsx +0 -6
  196. package/src/Separator.tsx +0 -2
  197. package/src/SharedTransition.tsx +0 -7
  198. package/src/Sheet.tsx +0 -3
  199. package/src/SheetRow.tsx +0 -12
  200. package/src/Skeleton.tsx +0 -10
  201. package/src/Spinner.tsx +0 -6
  202. package/src/StackPageHeader.tsx +0 -16
  203. package/src/StatGrid.tsx +0 -1
  204. package/src/StatusDot.tsx +0 -6
  205. package/src/SurfaceRow.tsx +0 -12
  206. package/src/SwipeableRow.tsx +0 -4
  207. package/src/Switch.tsx +3 -4
  208. package/src/Tabs.tsx +3 -27
  209. package/src/Textarea.tsx +0 -2
  210. package/src/ThemeToggle.tsx +0 -1
  211. package/src/Toast.tsx +3 -19
  212. package/src/UpdateChecker.tsx +0 -46
  213. package/src/ai/activity-question.tsx +0 -8
  214. package/src/ai/activity-step-detail.tsx +0 -5
  215. package/src/ai/activity-step-label.ts +0 -5
  216. package/src/ai/activity-step-types.ts +0 -24
  217. package/src/ai/activity-step.tsx +0 -4
  218. package/src/ai/activity-tasks-utils.ts +0 -13
  219. package/src/ai/activity-timeline.ts +0 -6
  220. package/src/ai/attachments.tsx +0 -13
  221. package/src/ai/chain-of-thought.tsx +0 -5
  222. package/src/ai/chat-jump-rail.tsx +0 -2
  223. package/src/ai/chat-text.ts +2 -3
  224. package/src/ai/chat-thread.tsx +0 -9
  225. package/src/ai/choice-question.tsx +0 -36
  226. package/src/ai/code-block.tsx +0 -52
  227. package/src/ai/collapsible.tsx +0 -12
  228. package/src/ai/conversation-context.ts +0 -14
  229. package/src/ai/conversation.tsx +0 -58
  230. package/src/ai/file-chip.tsx +0 -1
  231. package/src/ai/icon-button.tsx +5 -22
  232. package/src/ai/index.ts +0 -5
  233. package/src/ai/message-action-sheet.tsx +0 -8
  234. package/src/ai/message-context-menu.tsx +0 -22
  235. package/src/ai/message-quote.tsx +0 -4
  236. package/src/ai/message.tsx +0 -66
  237. package/src/ai/prompt-input-menu.tsx +0 -19
  238. package/src/ai/prompt-input.tsx +1 -98
  239. package/src/ai/reasoning.tsx +0 -6
  240. package/src/ai/reply-quote-chip.tsx +0 -5
  241. package/src/ai/response-text.tsx +0 -8
  242. package/src/ai/shimmer.tsx +0 -2
  243. package/src/ai/sources.tsx +0 -3
  244. package/src/ai/subagent-cards.tsx +0 -13
  245. package/src/ai/suggestion.tsx +0 -4
  246. package/src/ai/tool-approval-card.tsx +0 -14
  247. package/src/ai/trace.tsx +0 -23
  248. package/src/ai/unified-diff.tsx +0 -16
  249. package/src/ai/use-streaming-disclosure.ts +0 -4
  250. package/src/app-root/AuthGroupGate.tsx +0 -8
  251. package/src/app-root/SsoCallbackScreen.tsx +0 -10
  252. package/src/app-root/fonts.ts +0 -2
  253. package/src/auth/AccountScreens.tsx +0 -16
  254. package/src/auth/AuthProviders.tsx +0 -13
  255. package/src/auth/AuthScreen.tsx +0 -12
  256. package/src/auth/GoogleSignInButton.tsx +0 -12
  257. package/src/auth/SecondFactorScreen.tsx +0 -16
  258. package/src/auth/SignInScreen.tsx +0 -68
  259. package/src/auth/authErrors.ts +0 -6
  260. package/src/auth/clerkCore3.ts +0 -6
  261. package/src/auth/index.ts +0 -4
  262. package/src/auth/totp.ts +0 -13
  263. package/src/brand/AppIcons.tsx +0 -6
  264. package/src/brand/AppMark.tsx +0 -5
  265. package/src/brand/AppWordmark.tsx +0 -7
  266. package/src/brand/GoogleMark.tsx +0 -4
  267. package/src/brand/ProviderIcon.tsx +0 -6
  268. package/src/brand/familyApps.ts +0 -2
  269. package/src/brand/index.ts +0 -3
  270. package/src/brand/svg.ts +0 -9
  271. package/src/configureTheme.ts +0 -10
  272. package/src/controlStyles.ts +0 -12
  273. package/src/crash/LastCrashDialog.tsx +0 -6
  274. package/src/crash/lastCrash.ts +0 -21
  275. package/src/entries/ai.ts +0 -3
  276. package/src/entries/ambient.ts +0 -2
  277. package/src/entries/app-root.ts +0 -5
  278. package/src/entries/auth.ts +0 -4
  279. package/src/entries/bottom-sheet.ts +0 -2
  280. package/src/entries/brand.ts +0 -1
  281. package/src/entries/button.ts +0 -1
  282. package/src/entries/crash.ts +0 -3
  283. package/src/entries/date-time.ts +0 -2
  284. package/src/entries/expo-router.ts +0 -3
  285. package/src/entries/expo-web-root.ts +0 -2
  286. package/src/entries/floating.ts +0 -2
  287. package/src/entries/generative-ui.ts +0 -4
  288. package/src/entries/gesture-handler.ts +0 -3
  289. package/src/entries/keyboard-controller.ts +0 -3
  290. package/src/entries/layout.ts +0 -2
  291. package/src/entries/markdown.ts +0 -3
  292. package/src/entries/marketing.ts +0 -1
  293. package/src/entries/page-title.ts +0 -5
  294. package/src/entries/password-input.ts +0 -2
  295. package/src/entries/paste-input.ts +0 -3
  296. package/src/entries/primitives.ts +0 -6
  297. package/src/entries/search-input.ts +0 -2
  298. package/src/entries/tab-bar.ts +0 -2
  299. package/src/entries/theme.ts +2 -2
  300. package/src/entries/toast.ts +0 -3
  301. package/src/entries/video.ts +0 -2
  302. package/src/entries/webview.ts +0 -2
  303. package/src/examples/AiChatGallery.tsx +0 -11
  304. package/src/examples/ParityGallery.tsx +0 -25
  305. package/src/floating.ts +0 -6
  306. package/src/generative-ui/GenerativeUiPanel.tsx +0 -15
  307. package/src/generative-ui/components.tsx +0 -9
  308. package/src/generative-ui/context.ts +0 -2
  309. package/src/glass.ts +31 -0
  310. package/src/glassBlur.tsx +0 -15
  311. package/src/highlight.ts +0 -20
  312. package/src/index.ts +2 -2
  313. package/src/loadingGrid.ts +0 -12
  314. package/src/markdown/Markdown.tsx +0 -71
  315. package/src/markdown/MarkdownTable.tsx +0 -23
  316. package/src/markdown/tableText.ts +0 -3
  317. package/src/marketing/PricingModal.tsx +0 -13
  318. package/src/marketing/UpgradeToProCard.tsx +0 -14
  319. package/src/marketing/pricing.ts +0 -12
  320. package/src/media/ImageGallery.tsx +0 -18
  321. package/src/media/MediaCard.tsx +0 -8
  322. package/src/media/imageZoom.ts +0 -4
  323. package/src/media/zoom-image-gesture.tsx +0 -9
  324. package/src/media/zoomImage.ts +0 -5
  325. package/src/motion.ts +0 -3
  326. package/src/neutralTheme.ts +0 -3
  327. package/src/pagerSwipe.ts +0 -13
  328. package/src/palette.ts +0 -10
  329. package/src/pressScale.ts +0 -7
  330. package/src/primitives/button.tsx +0 -4
  331. package/src/primitives/card.tsx +0 -1
  332. package/src/primitives/input.tsx +0 -4
  333. package/src/primitives/keyboard-controller.tsx +0 -25
  334. package/src/primitives/keyboard-parts.tsx +0 -27
  335. package/src/primitives/native-only-animated-view.tsx +0 -5
  336. package/src/primitives/overlay.tsx +0 -25
  337. package/src/primitives/pager-gesture.tsx +0 -20
  338. package/src/primitives/paste-input.tsx +0 -4
  339. package/src/primitives/paste-parts.tsx +0 -1
  340. package/src/primitives/select.tsx +0 -16
  341. package/src/primitives/sheet-drag.tsx +0 -19
  342. package/src/primitives/sheet-gesture.tsx +0 -22
  343. package/src/primitives/swipe-row-gesture.tsx +0 -33
  344. package/src/primitives/switch.tsx +0 -4
  345. package/src/primitives/text.tsx +0 -4
  346. package/src/primitives/toast-drag-gesture.tsx +0 -13
  347. package/src/primitives/web-click-guard.ts +0 -2
  348. package/src/primitives/window-layer.tsx +0 -18
  349. package/src/push.ts +0 -15
  350. package/src/relativeTime.ts +0 -21
  351. package/src/router/RouterStackPageHeader.tsx +0 -1
  352. package/src/settings/MoreFromProjectV.tsx +0 -8
  353. package/src/settings/SettingsEmptyState.tsx +0 -2
  354. package/src/settings/SettingsSection.tsx +0 -3
  355. package/src/settings/SettingsToggleRow.tsx +0 -4
  356. package/src/settings/ThemeModePicker.tsx +0 -11
  357. package/src/settings/projectVMobileApps.ts +0 -8
  358. package/src/sheetDrag.ts +0 -9
  359. package/src/swipeRow.ts +0 -23
  360. package/src/tabBarRoutes.ts +0 -13
  361. package/src/tabIndicator.ts +0 -5
  362. package/src/tailwind-preset.cjs +0 -54
  363. package/src/tailwind-preset.d.cts +0 -8
  364. package/src/theme.tsx +11 -2
  365. package/src/themeModeStore.ts +0 -9
  366. package/src/toastChrome.ts +0 -6
  367. package/src/toastDrag.ts +0 -13
  368. package/src/toastStore.ts +0 -7
  369. package/src/updateCheck.ts +0 -15
  370. package/src/video/InlineVideo.tsx +0 -5
  371. package/src/webview/HtmlView.tsx +0 -23
  372. package/src/webview/HtmlView.web.tsx +0 -1
  373. package/src/webview/htmlView.ts +0 -5
@@ -1,11 +1,5 @@
1
1
  import { useSyncExternalStore } from "react";
2
2
 
3
- // The last error that closed the app. A release build closes with no message
4
- // and no log a phone user can read, so the global error handler saves the
5
- // error here and the next launch shows it (`LastCrashDialog`), ready to copy.
6
- // Moved from eva (`apps/mobile/src/logging`). Not moved: eva's native exit
7
- // record (its own Expo module) and the report to its backend.
8
-
9
3
  /** Where the crash is kept between launches, for example `expo-secure-store`. */
10
4
  export type CrashStorage = {
11
5
  getItem: (key: string) => Promise<string | null>;
@@ -17,9 +11,7 @@ export type CrashStorage = {
17
11
  export type FatalReport = { name: string; message: string; stack: string };
18
12
 
19
13
  export type LastCrash = FatalReport & {
20
- /** Epoch milliseconds. */
21
14
  at: number;
22
- /** The app version that crashed. */
23
15
  version: string;
24
16
  };
25
17
 
@@ -31,14 +23,9 @@ type SecureStoreModule = {
31
23
  type ConstantsModule = { default?: { expoConfig?: { version?: string } | null } };
32
24
 
33
25
  const KEY = "v.lastCrash";
34
- /** SecureStore values over 2 KB warn on iOS, so a report is cut below that. */
35
26
  const MAX_CHARS = 1_800;
36
- /** How long a fatal error waits for the save before the app closes anyway. */
37
27
  const FATAL_SAVE_MS = 1_000;
38
28
 
39
- // `expo-secure-store` and `expo-constants` are optional peers. Metro bundles a
40
- // `require` placed directly in a `try` block as optional, so a missing peer
41
- // does not break the bundle.
42
29
  let secureStore: CrashStorage | null | undefined;
43
30
  function defaultStorage(): CrashStorage | null {
44
31
  if (secureStore === undefined) {
@@ -108,7 +95,6 @@ export async function saveLastCrash(report: FatalReport): Promise<void> {
108
95
  }
109
96
  await storage.setItem(KEY, json);
110
97
  } catch {
111
- // A crash logger must never throw.
112
98
  }
113
99
  }
114
100
 
@@ -119,7 +105,6 @@ export async function loadLastCrash(): Promise<void> {
119
105
  const parsed: unknown = saved ? JSON.parse(saved) : null;
120
106
  if (isLastCrash(parsed)) publish(parsed);
121
107
  } catch {
122
- // Nothing to show.
123
108
  }
124
109
  }
125
110
 
@@ -165,7 +150,6 @@ function trackerOf(env: object): Tracker | null {
165
150
  return typeof tracker === "function" ? (tracker as Tracker) : null;
166
151
  }
167
152
 
168
- /** Logs name, message and a short stack, so release builds show it in logcat. Never throws. */
169
153
  function logUncaught(kind: "unhandled-rejection" | "uncaught-error", caught: Caught, isFatal?: boolean) {
170
154
  try {
171
155
  const report = fatalReport(caught);
@@ -177,18 +161,14 @@ function logUncaught(kind: "unhandled-rejection" | "uncaught-error", caught: Cau
177
161
  stack: report.stack.split("\n").slice(0, 6).join("\n"),
178
162
  });
179
163
  } catch {
180
- // A logger must never throw.
181
164
  }
182
165
  }
183
166
 
184
167
  let installed = false;
185
168
 
186
169
  export type CrashCaptureOptions = {
187
- /** Default: `expo-secure-store` when it is installed. Without storage nothing is saved. */
188
170
  storage?: CrashStorage | null;
189
- /** Default: `expo-constants`' `expoConfig.version`. */
190
171
  version?: string;
191
- /** The global object. Tests pass a fake. */
192
172
  env?: object;
193
173
  };
194
174
 
@@ -219,7 +199,6 @@ export function installCrashCapture(options: CrashCaptureOptions = {}): boolean
219
199
  previous(error, isFatal);
220
200
  return;
221
201
  }
222
- // Save first, then let the app close as before.
223
202
  const timeout = new Promise<void>((resolve) => setTimeout(resolve, FATAL_SAVE_MS));
224
203
  void Promise.race([saveLastCrash(fatalReport(error)), timeout]).finally(() => previous(error, isFatal));
225
204
  });
package/src/entries/ai.ts CHANGED
@@ -1,4 +1 @@
1
- // `@vvedantb/native-ui/ai`: the AI chat parts. Reaches no optional peer, not
2
- // even a loader; the composer uses `react-native-safe-area-context` and the
3
- // shimmer `react-native-reanimated`, both required peers.
4
1
  export * from "../ai";
@@ -1,3 +1 @@
1
- // `@vvedantb/native-ui/ambient`. Loads `expo-linear-gradient` only through its
2
- // optional-peer loader; without it the background is solid.
3
1
  export { AmbientBackground } from "../AmbientBackground";
@@ -1,6 +1 @@
1
- // `@vvedantb/native-ui/app-root`: the Instrument Sans font helper, the splash hide
2
- // helper, `AuthGroupGate` and `SsoCallbackScreen` for Expo app shells. Apps keep their
3
- // own provider trees. Not on the root entry: it imports `@clerk/expo`, `expo-router`,
4
- // `expo-font`, `expo-splash-screen` and `@expo-google-fonts/instrument-sans`, and Metro
5
- // does not tree-shake.
6
1
  export * from "../app-root";
@@ -1,5 +1 @@
1
- // `@vvedantb/native-ui/auth`: `AuthProviders`, `SignInScreen`, `SignUpScreen`,
2
- // `GoogleSignInButton` and the auth frame. Not on the root entry: it imports
3
- // `@clerk/expo`, `convex`, `expo-auth-session`, `expo-web-browser` and
4
- // `expo-router`, and Metro does not tree-shake.
5
1
  export * from "../auth";
@@ -1,3 +1 @@
1
- // `@vvedantb/native-ui/bottom-sheet`. Imports `@swmansion/react-native-bottom-sheet`
2
- // (an optional peer).
3
1
  export { BottomSheetContainer } from "../BottomSheetContainer";
@@ -1,2 +1 @@
1
- // `@vvedantb/native-ui/brand`: the family app marks and their pure data, and `GoogleMark`.
2
1
  export * from "../brand";
@@ -1,3 +1,2 @@
1
- // `@vvedantb/native-ui/button`.
2
1
  export { Button } from "../Button";
3
2
  export type { ButtonProps, ButtonShape, ButtonSize, ButtonVariant } from "../Button";
@@ -1,6 +1,3 @@
1
- // `@vvedantb/native-ui/crash`: shows the error that closed the app last time.
2
- // Call `installCrashCapture()` once at the top of the root layout and mount
3
- // `<LastCrashDialog appName="…" />` inside it.
4
1
  export { LastCrashDialog } from "../crash/LastCrashDialog";
5
2
  export type { LastCrashDialogProps } from "../crash/LastCrashDialog";
6
3
  export {
@@ -1,4 +1,2 @@
1
- // `@vvedantb/native-ui/date-time`. Imports
2
- // `@react-native-community/datetimepicker` and `dayjs`.
3
1
  export { DateTimeField } from "../DateTimeField";
4
2
  export type { DateTimeFieldProps } from "../DateTimeField";
@@ -1,6 +1,3 @@
1
- // `@vvedantb/native-ui/expo-router`: components that need `expo-router`, an
2
- // optional peer. Not on the root, `/layout` or `/page-title` entries: they
3
- // never import it.
4
1
  export { RouterStackPageHeader, goBackOrReplace } from "../router/RouterStackPageHeader";
5
2
  export type { RouterStackPageHeaderProps } from "../router/RouterStackPageHeader";
6
3
  export { TabScreen } from "../router/TabScreen";
@@ -1,4 +1,2 @@
1
- // `@vvedantb/native-ui/expo-web-root`: `ExpoWebRoot` for `app/+html.tsx`. Not on
2
- // the root entry: it imports `expo-router/html`, and Metro does not tree-shake.
3
1
  export { ExpoWebRoot, EXPO_WEB_VIEWPORT, expoWebBackgroundCss } from "../ExpoWebRoot";
4
2
  export type { ExpoWebRootProps, ExpoWebRootViewport } from "../ExpoWebRoot";
@@ -1,5 +1,3 @@
1
- // `@vvedantb/native-ui/floating`: floating surfaces, glass blur targets and
2
- // metrics. Reaches `expo-blur` only through its optional-peer loader.
3
1
  export {
4
2
  FLOATING_INSET,
5
3
  FLOATING_TAB_BAR_HEIGHT,
@@ -1,7 +1,3 @@
1
- // `@vvedantb/native-ui/generative-ui`: agent-composed panels from the shared
2
- // catalog (`@vvedantb/server/generative-ui`), as the web
3
- // `@vvedantb/ui/generative-ui`. Imports `@json-render/react-native` (an
4
- // optional peer): the only entry that does, so an app without it bundles none.
5
1
  export { GenerativeUiPanel } from "../generative-ui/GenerativeUiPanel";
6
2
  export type { GenerativeUiPanelProps } from "../generative-ui/GenerativeUiPanel";
7
3
  export { generativeUiNativeCatalog } from "../generative-ui/renderer";
@@ -1,4 +1 @@
1
- // `@vvedantb/native-ui/gesture-handler`. Imports `react-native-gesture-handler`
2
- // (an optional peer): the only entry that does, so an app without it bundles
3
- // the `PanResponder` sheets as before.
4
1
  export { GestureHandlerProvider } from "../primitives/sheet-gesture";
@@ -1,4 +1 @@
1
- // `@vvedantb/native-ui/keyboard-controller`. Imports
2
- // `react-native-keyboard-controller` (an optional peer): the only entry that
3
- // does, so an app without it keeps React Native's `KeyboardAvoidingView`.
4
1
  export { KeyboardControllerProvider } from "../primitives/keyboard-controller";
@@ -1,5 +1,3 @@
1
- // `@vvedantb/native-ui/layout`: screen containers, page headers, section
2
- // labels and settings chrome.
3
1
  export { SafeAreaContainer } from "../SafeAreaContainer";
4
2
  export { ScreenContainer } from "../ScreenContainer";
5
3
  export type { ScreenContainerProps } from "../ScreenContainer";
@@ -1,5 +1,2 @@
1
- // `@vvedantb/native-ui/markdown`: `Markdown`, chat markdown styled as the web
2
- // `.markdown` block. Not on the root entry: it imports the optional peer
3
- // `react-native-marked`, and Metro does not tree-shake.
4
1
  export { Markdown, markdownStyles, inlineCodeStyle, MARKDOWN_SCALE, MARKDOWN_LIST } from "../markdown/Markdown";
5
2
  export type { MarkdownHeadings, MarkdownProps } from "../markdown/Markdown";
@@ -1,4 +1,3 @@
1
- // `@vvedantb/native-ui/marketing`: the upgrade card and pricing modal.
2
1
  export { UpgradeToProCard } from "../marketing/UpgradeToProCard";
3
2
  export type { UpgradeToProCardProps } from "../marketing/UpgradeToProCard";
4
3
  export { PricingModal } from "../marketing/PricingModal";
@@ -1,8 +1,3 @@
1
- // `@vvedantb/native-ui/page-title`: `PageTitle`, `PageHeader` and (from 0.5.0)
2
- // `StackPageHeader`. Reaches no optional peer, not even a loader.
3
- // `StackPageHeader` imports one Tabler icon (a required peer) for its back
4
- // button; Metro does not tree-shake by default, so that bundles the Tabler
5
- // package with this entry.
6
1
  export { PageTitle, PageHeader } from "../PageTitle";
7
2
  export type { PageTitleProps, PageHeaderProps } from "../PageTitle";
8
3
  export { StackPageHeader } from "../StackPageHeader";
@@ -1,4 +1,2 @@
1
- // `@vvedantb/native-ui/password-input`: `PasswordInput` on its own. Reaches no
2
- // optional peer, not even a loader.
3
1
  export { PasswordInput } from "../PasswordInput";
4
2
  export type { PasswordInputProps } from "../PasswordInput";
@@ -1,4 +1 @@
1
- // `@vvedantb/native-ui/paste-input`. Imports `expo-paste-input` (an optional
2
- // peer with native code): the only entry that does, so an app without it keeps
3
- // text-only paste and bundles as before.
4
1
  export { PasteInputProvider } from "../primitives/paste-input";
@@ -1,7 +1,3 @@
1
- // `@vvedantb/native-ui/primitives`: fields, display, tabs, overlays and
2
- // toasts. `BottomSheetContainer`, `DateTimeField` and `AmbientBackground` are
3
- // not here; they have their own entries. `Text` and `TextClassContext` are the
4
- // `primitives/text` variants (from 0.5.0); they are not on the root entry.
5
1
  export { Text, TextClassContext } from "../primitives/text";
6
2
  export { Button } from "../Button";
7
3
  export type { ButtonProps, ButtonShape, ButtonSize, ButtonVariant } from "../Button";
@@ -175,7 +171,6 @@ export { Toaster } from "../Toast";
175
171
  export { toast } from "../toastStore";
176
172
  export type { ToastOptions, ToastVariant } from "../toastStore";
177
173
 
178
- // Shared element transitions (Reanimated 4.8): the same `tag` on two screens moves the view between them.
179
174
  export {
180
175
  DEFAULT_SHARED_TRANSITION,
181
176
  DEFAULT_FADE_CONTENT,
@@ -187,5 +182,4 @@ export {
187
182
  } from "../SharedTransition";
188
183
  export type { SharedTransitionOverrides, SharedTransitionViewProps, SharedTransitionTextProps } from "../SharedTransition";
189
184
 
190
- // Overlays in the app's window (the hold menu, the image viewer): wrap the navigator once.
191
185
  export { WindowLayerHost } from "../primitives/window-layer";
@@ -1,4 +1,2 @@
1
- // `@vvedantb/native-ui/search-input`: `SearchInput` on its own. Reaches no
2
- // optional peer, not even a loader.
3
1
  export { SearchInput } from "../SearchInput";
4
2
  export type { SearchInputProps } from "../SearchInput";
@@ -1,5 +1,3 @@
1
- // `@vvedantb/native-ui/tab-bar`. Does not import `expo-router`; reaches
2
- // `expo-blur` and `expo-haptics` only through their optional-peer loaders.
3
1
  export { FloatingTabBar } from "../FloatingTabBar";
4
2
  export type { FloatingTabBarProps } from "../FloatingTabBar";
5
3
  export {
@@ -1,4 +1,3 @@
1
- // `@vvedantb/native-ui/theme`: the provider, tokens and colour helpers.
2
1
  export { cn } from "../cn";
3
2
  export {
4
3
  tokens,
@@ -6,9 +5,10 @@ export {
6
5
  useNativeUi,
7
6
  useLargerText,
8
7
  useAccentColor,
8
+ useSurface,
9
9
  DEFAULT_ACCENT,
10
10
  } from "../theme";
11
- export type { NativeUiTheme } from "../theme";
11
+ export type { NativeUiTheme, NativeUiSurface } from "../theme";
12
12
  export { palette, withAlpha } from "../palette";
13
13
  export type { Palette } from "../palette";
14
14
  export { configureTheme } from "../configureTheme";
@@ -1,6 +1,3 @@
1
- // `@vvedantb/native-ui/toast`: `toast()` and `<Toaster />`. Reaches no heavy
2
- // optional peer, not even a loader (the toast surface is flat from 0.3.12): no
3
- // `expo-blur`, bottom sheet, date picker, `dayjs` or `expo-router`.
4
1
  export { Toaster } from "../Toast";
5
2
  export { toast } from "../toastStore";
6
3
  export type { ToastOptions, ToastVariant } from "../toastStore";
@@ -1,4 +1,2 @@
1
- // `@vvedantb/native-ui/video`. Imports `expo-video` (an optional peer): the
2
- // only entry that does, so an app without it bundles no video player.
3
1
  export { InlineVideo, INLINE_VIDEO_ASPECT } from "../video/InlineVideo";
4
2
  export type { InlineVideoProps } from "../video/InlineVideo";
@@ -1,5 +1,3 @@
1
- // `@vvedantb/native-ui/webview`. Imports `react-native-webview` (an optional
2
- // peer): the only entry that does, so an app without it bundles no WebView.
3
1
  export { HtmlView } from "../webview/HtmlView";
4
2
  export type { HtmlViewHandle, HtmlViewProps } from "../webview/HtmlView";
5
3
  export { HTML_VIEW_HEIGHT_SCRIPT, htmlViewNavigation, htmlViewPostScript, parseHtmlViewHeight } from "../webview/htmlView";
@@ -1,8 +1,3 @@
1
- // Reference screen for the AI chat parts (`@vvedantb/native-ui/ai`). Render
2
- // `AiChatGallery` in a full-screen Expo route, with the same NativeWind setup
3
- // as the rest of the package and a `SafeAreaProvider` above it. The thread is
4
- // fixed sample text, not a model. It follows the app's larger-text setting.
5
- // `ParityGallery` shows `AiChatSamples` in its "AI chat" section.
6
1
  import { useState } from "react";
7
2
  import { View } from "react-native";
8
3
  import { IconFileText, IconPaperclip, IconSearch } from "@tabler/icons-react-native";
@@ -75,11 +70,6 @@ const SAMPLE_CODE = `type Change = {\n itemId: string;\n updatedAt: number;\n}
75
70
  const STREAMING_REASONING =
76
71
  "Offline edits need to wait in a queue on the device.\nWhen the connection returns, send the queue in order and merge by timestamp…";
77
72
 
78
- /**
79
- * The sample thread: a user message, a finished assistant message (folded
80
- * reasoning and trace, reply, code, sources and actions), a second user
81
- * message, and an assistant message that is still working while `streaming`.
82
- */
83
73
  const DRAFT_FIELDS: DraftField[] = [
84
74
  { key: "to", role: "to", value: "team@example.com" },
85
75
  { key: "subject", role: "subject", value: "Weekly plan" },
@@ -179,7 +169,6 @@ export function AiChatSamples({ streaming = true }: { streaming?: boolean }) {
179
169
  </AgentTraceCollapsibleContent>
180
170
  </AgentTraceCollapsible>
181
171
  <ResponseText>{FINISHED_REPLY}</ResponseText>
182
- {/* The gallery has no clipboard: the button only shows its copied state. */}
183
172
  <CodeBlock language="ts" code={SAMPLE_CODE} onCopy={() => undefined} />
184
173
  <Sources>
185
174
  <SourcesTrigger count={2} />
@@ -1,8 +1,3 @@
1
- // Reference screen for the components that mirror `@vvedantb/ui`. Render it in
2
- // an Expo route to compare against the web: it needs the same NativeWind setup
3
- // as the rest of the package and a `SafeAreaProvider` above it. It always
4
- // renders the default sizes (larger text off), as the web does. Prices, names
5
- // and figures below are placeholders, not real data.
6
1
  import { useState, type ReactNode } from "react";
7
2
  import { ScrollView, Text, View, type TextProps } from "react-native";
8
3
  import {
@@ -136,7 +131,6 @@ import {
136
131
  } from "../ai";
137
132
  import { AiChatSamples } from "./AiChatGallery";
138
133
 
139
- // Every shared variant; the aliases (`primary`, `tertiary`, `danger`) draw as the name they alias.
140
134
  const BUTTON_VARIANTS: ButtonVariant[] = [
141
135
  "default",
142
136
  "primary",
@@ -177,8 +171,6 @@ const STATUS_TONES: StatusTone[] = [
177
171
  const SWATCHES = ["#db2777", "#2563eb", "#16a34a", "#f59e0b", "#181818", "#ffffff"];
178
172
  const SWATCH_LABELS = ["Pink", "Blue", "Green", "Amber", "Black", "White"];
179
173
 
180
- // Space after the last section, so Card, Upgrade and Overlays can scroll to the
181
- // top of an 844-tall phone for screenshot crops.
182
174
  const GALLERY_END_SPACE = 720;
183
175
 
184
176
  const PLANS: PricingPlan[] = [
@@ -198,7 +190,6 @@ const PLANS: PricingPlan[] = [
198
190
  },
199
191
  ];
200
192
 
201
- /** Body text in the scheme's foreground (a style, so it reads in dark mode too). */
202
193
  function GalleryText({ className, style, ...props }: TextProps & { className?: string }) {
203
194
  const scheme = useScheme();
204
195
  return (
@@ -257,14 +248,12 @@ function GalleryScreen() {
257
248
  return (
258
249
  <View className="flex-1">
259
250
  <ScrollView
260
- // So the SearchInput clear button takes the first tap while the keyboard is up.
261
251
  keyboardShouldPersistTaps="handled"
262
252
  contentContainerClassName="gap-8 px-4 pt-4"
263
253
  contentContainerStyle={{ paddingBottom: GALLERY_END_SPACE }}
264
254
  >
265
255
  <Section title="Page title">
266
256
  <PageTitle>Updates</PageTitle>
267
- {/* `safeTop={false}` and `px-0`: here the header is not at the top of the screen, and the scroll view pads the sides. */}
268
257
  <PageHeader
269
258
  title="Apps"
270
259
  safeTop={false}
@@ -275,7 +264,6 @@ function GalleryScreen() {
275
264
  </Button>
276
265
  }
277
266
  />
278
- {/* A header icon action: switches the gallery between light and dark. */}
279
267
  <PageHeader title="Settings" safeTop={false} className="px-0" action={<ThemeToggle />} />
280
268
  </Section>
281
269
 
@@ -298,7 +286,6 @@ function GalleryScreen() {
298
286
  </Section>
299
287
 
300
288
  <Section title="Button">
301
- {/* The web gallery: a full-width column of variants, then the sm row. */}
302
289
  <View className="gap-2">
303
290
  {BUTTON_VARIANTS.map((variant) => (
304
291
  <Button key={variant} testID={`button-variant-${variant}`} variant={variant} onPress={() => toast(variant)}>
@@ -329,7 +316,6 @@ function GalleryScreen() {
329
316
  <IconCopy size={16} color={tokens.color.foreground[scheme]} />
330
317
  </Button>
331
318
  </View>
332
- {/* Pills by default, as on the web. `shape="rounded"` keeps radius 16, the look before 0.6.0. */}
333
319
  <View className="flex-row flex-wrap items-center gap-2">
334
320
  <Button shape="rounded" size="sm" fullWidth={false}>
335
321
  Rounded
@@ -378,7 +364,6 @@ function GalleryScreen() {
378
364
  <FieldDescription testID="field-parity-description">We never share it.</FieldDescription>
379
365
  <FieldError testID="field-parity-error">Enter a valid email.</FieldError>
380
366
  </Field>
381
- {/* Empty (`sm`: icon and placeholder) and filled (`md`: the clear button). */}
382
367
  <SearchInput value={emptySearch} onChange={setEmptySearch} />
383
368
  <SearchInput value={search} onChange={setSearch} size="md" label="Search colours" />
384
369
  <Textarea placeholder="Notes" accessibilityLabel="Notes" />
@@ -651,7 +636,6 @@ function GalleryScreen() {
651
636
  </EmptyState.Root>
652
637
  </Section>
653
638
 
654
- {/* 0.5.0: the Verve, vibot and Velth pieces. */}
655
639
  <Section title="ColorSwatches">
656
640
  <ColorSwatches
657
641
  value={swatch}
@@ -672,7 +656,6 @@ function GalleryScreen() {
672
656
  </Section>
673
657
 
674
658
  <Section title="DateTimeField">
675
- {/* Date only, empty until picked, with a clear button once set. */}
676
659
  <DateTimeField
677
660
  mode="date"
678
661
  value={due}
@@ -684,7 +667,6 @@ function GalleryScreen() {
684
667
  </Section>
685
668
 
686
669
  <Section title="ListRow">
687
- {/* Long-press the first row for its second action. */}
688
670
  <ListRow
689
671
  title="Ada Lovelace"
690
672
  meta="See you at nine"
@@ -701,7 +683,6 @@ function GalleryScreen() {
701
683
  onPress={() => toast("Open thread")}
702
684
  onLongPress={() => toast("Thread actions")}
703
685
  />
704
- {/* The switch sits outside the pressable area: it toggles without opening the row. */}
705
686
  <ListRow
706
687
  title="Mute thread"
707
688
  meta="Tap the row or the switch"
@@ -731,7 +712,6 @@ function GalleryScreen() {
731
712
  </Section>
732
713
 
733
714
  <Section title="SheetRow">
734
- {/* Static rows on the sheet surface; in an app they sit in a `SheetContent`. */}
735
715
  <View className="py-2" style={{ backgroundColor: palette.overlay[scheme], borderRadius: tokens.radius.lg }}>
736
716
  <SheetRow icon={IconCopy} title="Copy link" onPress={() => toast("Copied")} />
737
717
  <SheetRow icon={IconPhoto} title="Save image" detail="To your photo library" onPress={() => toast("Saved")} />
@@ -748,7 +728,6 @@ function GalleryScreen() {
748
728
  </Section>
749
729
 
750
730
  <Section title="StackPageHeader">
751
- {/* `safeTop={false}`: the strip is not at the top of the screen. */}
752
731
  <AmbientBackground className="flex-none overflow-hidden rounded-lg">
753
732
  <StackPageHeader
754
733
  title="Details"
@@ -764,7 +743,6 @@ function GalleryScreen() {
764
743
  </Section>
765
744
 
766
745
  <Section title="More from Project V">
767
- {/* As in Velth's settings: the other four phone apps. A row opens the app, else V Store, else the website. */}
768
746
  <MoreFromProjectV
769
747
  current="velth"
770
748
  onOpen={(id, target) => toast(target ? `Opened ${id} (${target})` : `Could not open ${id}`)}
@@ -773,7 +751,6 @@ function GalleryScreen() {
773
751
  </Section>
774
752
 
775
753
  <Section title="Camera chrome">
776
- {/* A dark stand-in for the live preview. */}
777
754
  <View className="h-72 justify-between overflow-hidden rounded-lg p-4" style={{ backgroundColor: NEUTRAL_900 }}>
778
755
  <View className="flex-row justify-between">
779
756
  <IconButton variant="overlay" icon={IconX} label="Close camera" onPress={() => toast("Close")} />
@@ -794,7 +771,6 @@ function GalleryScreen() {
794
771
  </Section>
795
772
 
796
773
  <Section title="Stepper">
797
- {/* Minus is disabled at `min` (1 here), plus at `max` (6). */}
798
774
  <View className="flex-row items-center justify-between rounded-lg bg-surface px-4 py-3">
799
775
  <GalleryText>Tablets</GalleryText>
800
776
  <Stepper
@@ -811,7 +787,6 @@ function GalleryScreen() {
811
787
  <GalleryText testID="stepper-dose-value">{`Dose: ${dose}`}</GalleryText>
812
788
  </Section>
813
789
 
814
- {/* The full chat screen, with the composer and keyboard, is `AiChatGallery` (`@vvedantb/native-ui/ai-gallery`). */}
815
790
  <Section title="AI chat">
816
791
  <AiChatSamples />
817
792
  <ChainOfThought defaultOpen>
package/src/floating.ts CHANGED
@@ -14,12 +14,6 @@ export const FLOATING_PILL_RADIUS = tokens.radius.pill;
14
14
 
15
15
  const FLOATING_BOX_SHADOW = "0px 8px 24px rgba(10, 10, 10, 0.12)";
16
16
 
17
- /**
18
- * Only the shadow keys, not `ViewStyle`: an Expo-widened `ViewStyle`
19
- * (`position: "fixed"`, `backgroundImage`) is not assignable to a React
20
- * Native 0.88 View `style`. A plain inferred type would be `{}` and lose
21
- * `floatingShadow.shadowColor` and the rest for callers.
22
- */
23
17
  type FloatingShadowStyle = {
24
18
  shadowColor?: string;
25
19
  shadowOffset?: { width: number; height: number };
@@ -8,22 +8,10 @@ import { GenerativeUiPanelContext } from "./context";
8
8
  import { GenerativeUiRenderer } from "./renderer";
9
9
 
10
10
  export type GenerativeUiPanelProps = {
11
- /** The stored json-render spec, still serialised. */
12
11
  spec: string;
13
- /**
14
- * Sends a button's text back to the agent. Undefined when the app cannot
15
- * send now (an archived chat, a sleeping sandbox): every button is then
16
- * disabled, as the web panel's disabled fieldset.
17
- */
18
12
  onReply?: (message: string) => void;
19
- /** Opens a button's link. Only http(s) URLs reach it. Default: `Linking.openURL`. */
20
13
  onOpenUrl?: (url: string) => void;
21
- /** Copies a code block. Without it, code blocks have no copy button. */
22
14
  onCopy?: (text: string) => void | Promise<void>;
23
- /**
24
- * Draws an element type this catalog does not know (a spec from a newer
25
- * catalog). Default: nothing, as the web panel.
26
- */
27
15
  renderUnsupported?: (type: string) => ReactNode;
28
16
  testID?: string;
29
17
  };
@@ -34,7 +22,6 @@ const openUrl = (url: string) => {
34
22
 
35
23
  const UnsupportedContext = createContext<((type: string) => ReactNode) | undefined>(undefined);
36
24
 
37
- /** json-render's fallback for an unknown type, drawn by the app's `renderUnsupported`. */
38
25
  function UnsupportedElement({ element }: ComponentRenderProps) {
39
26
  const render = useContext(UnsupportedContext);
40
27
  return render ? <>{render(element.type)}</> : null;
@@ -65,13 +52,11 @@ export function GenerativeUiPanel({
65
52
  }
66
53
  if (actionName === "open_url") {
67
54
  const url = params?.url;
68
- // A stored spec is data: only an http(s) link opens.
69
55
  if (typeof url === "string" && isHttpUrl(url)) onOpenUrl(url);
70
56
  }
71
57
  };
72
58
 
73
59
  return (
74
- // The web `Surface density="tight"`: the card fill, radius 16, `p-3`.
75
60
  <View testID={testID} className="min-w-0 p-3" style={cardStyle(scheme)}>
76
61
  <GenerativeUiPanelContext.Provider value={{ canPress: onReply !== undefined, onCopy }}>
77
62
  <UnsupportedContext.Provider value={renderUnsupported}>
@@ -15,13 +15,6 @@ import { useScheme } from "../useScheme";
15
15
  import { useGenerativeUiPanel } from "./context";
16
16
  import { ALIGN, BADGE_VARIANT, BUTTON_VARIANT, GAP, toneSurface, toneText } from "./styles";
17
17
 
18
- /**
19
- * The phone parts of a generative UI panel, one per catalog component, drawn
20
- * as the web `@vvedantb/ui/generative-ui` draws them: the same sizes, tones and
21
- * gaps, on the native theme tokens.
22
- */
23
-
24
- /** The web `text-2xs` (11 / 14), for a metric's delta; the other sizes are the shared `text-*`. */
25
18
  const TEXT_2XS = { fontSize: 11, lineHeight: 14 };
26
19
 
27
20
  const FONT_CLASS = {
@@ -154,7 +147,6 @@ export function MetricElement({ element }: ComponentRenderProps<GenerativeUiProp
154
147
  return (
155
148
  <View className="min-w-0 gap-0.5" accessible accessibilityLabel={`${label}, ${value}`}>
156
149
  <Line size="text-xs" color={tokens.color.muted[scheme]} text={label} />
157
- {/* The web `text-lg font-medium tabular-nums leading-tight`. */}
158
150
  <Text
159
151
  className={FONT_CLASS.semibold}
160
152
  style={[
@@ -298,7 +290,6 @@ export function ImageElement({ element }: ComponentRenderProps<GenerativeUiProps
298
290
  const [aspect, setAspect] = useState(4 / 3);
299
291
  const [width, setWidth] = useState(0);
300
292
  const [failed, setFailed] = useState(false);
301
- // A stored spec is data: only a hosted http(s) image loads, never `file:` or `content:`.
302
293
  if (!isHttpUrl(url) || failed) return null;
303
294
  const height = width > 0 ? Math.min(320, width / aspect) : 0;
304
295
  return (
@@ -2,9 +2,7 @@ import { createContext, useContext } from "react";
2
2
 
3
3
  /** What a panel passes to every element it draws. */
4
4
  export type GenerativeUiPanelOptions = {
5
- /** False when the app cannot reply: every button is disabled, as the web's disabled fieldset. */
6
5
  canPress: boolean;
7
- /** Copies a code block. Without it, code blocks have no copy button. */
8
6
  onCopy?: (text: string) => void | Promise<void>;
9
7
  };
10
8
 
package/src/glass.ts ADDED
@@ -0,0 +1,31 @@
1
+ import { useSurface } from "./theme";
2
+ import { useScheme } from "./useScheme";
3
+
4
+ type Scheme = "light" | "dark";
5
+
6
+ export type GlassKind = "surface" | "control" | "small";
7
+
8
+ const HIGHLIGHT = { light: 0.5, dark: 0.12 } as const;
9
+ const RIM = { light: 0.4, dark: 0.08 } as const;
10
+ const DROP = {
11
+ surface: "0px 1px 3px rgba(0, 0, 0, 0.08)",
12
+ control: "0px 1px 2px rgba(0, 0, 0, 0.12)",
13
+ small: "0px 1px 1px rgba(0, 0, 0, 0.08)",
14
+ } as const;
15
+
16
+ /**
17
+ * The glass finish as a `boxShadow` string: a thin inset rim, a soft top-left
18
+ * highlight and a small drop shadow. The same recipe as the web components.
19
+ */
20
+ export function glassShadow(kind: GlassKind, scheme: Scheme) {
21
+ const rim = `inset 0px 0px 0px 1px rgba(255, 255, 255, ${RIM[scheme]})`;
22
+ const highlight = `inset 1.5px 1.5px 1px -1px rgba(255, 255, 255, ${HIGHLIGHT[scheme]})`;
23
+ return `${rim}, ${highlight}, ${DROP[kind]}`;
24
+ }
25
+
26
+ /** The glass style for `kind`, or `null` when `NativeUiProvider` sets `surface="flat"`. */
27
+ export function useGlass(kind: GlassKind): { boxShadow: string } | null {
28
+ const scheme = useScheme();
29
+ if (useSurface() === "flat") return null;
30
+ return { boxShadow: glassShadow(kind, scheme) };
31
+ }