@vvedantb/native-ui 0.38.0 → 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.
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 +0 -1
  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 +0 -8
  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 +0 -27
  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 +0 -1
  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 +0 -17
  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 +0 -97
  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
package/src/glassBlur.tsx CHANGED
@@ -10,12 +10,6 @@ import {
10
10
  import { StyleSheet, View, type ViewProps } from "react-native";
11
11
  import { loadBlur, type BlurTargetElement, type BlurTargetRef } from "./blur";
12
12
 
13
- /**
14
- * The current blur target, outside React state. A target change (each tab
15
- * switch hands it from one tab to the next) then re-renders only the glass
16
- * that subscribes, not the whole tab tree under the provider: as a context
17
- * value it walked every mounted tab twice per switch.
18
- */
19
13
  type BlurTargetStore = {
20
14
  get: () => BlurTargetRef | null;
21
15
  set: (next: BlurTargetRef | null) => void;
@@ -39,9 +33,6 @@ function createBlurTargetStore(): BlurTargetStore {
39
33
  };
40
34
  }
41
35
 
42
- // `null` outside a provider and inside a target (a blur view must not sit
43
- // inside its own target). The value is the provider's one store, so it never
44
- // changes.
45
36
  const BlurTargetStoreContext = createContext<BlurTargetStore | null>(null);
46
37
 
47
38
  const noSubscribe = () => () => {};
@@ -63,7 +54,6 @@ export function GlassBlurProvider({ children }: { children: ReactNode }) {
63
54
  }
64
55
 
65
56
  export type GlassBlurTargetProps = ViewProps & {
66
- /** Set `false` while the content is hidden, such as an unfocused tab. */
67
57
  active?: boolean;
68
58
  };
69
59
 
@@ -83,8 +73,6 @@ export function GlassBlurTarget({
83
73
  const ref = useRef<BlurTargetElement>(null);
84
74
  const BlurTargetView = loadBlur()?.BlurTargetView;
85
75
 
86
- // Publish the ref only once it is attached: expo-blur compares
87
- // `blurTarget.current` between renders to pick up a new target.
88
76
  useLayoutEffect(() => {
89
77
  if (!store || !active) {
90
78
  return;
@@ -95,11 +83,8 @@ export function GlassBlurTarget({
95
83
  };
96
84
  }, [store, active]);
97
85
 
98
- // Surfaces in here get no target: a blur view must not sit inside its own.
99
86
  const content = <BlurTargetStoreContext.Provider value={null}>{children}</BlurTargetStoreContext.Provider>;
100
87
 
101
- // The plain `View` is the fallback when expo-blur is absent: no `BlurView`
102
- // then reads the store, so this branch needs no target ref.
103
88
  return BlurTargetView ? (
104
89
  <BlurTargetView ref={ref} style={[styles.fill, style]} {...props}>
105
90
  {content}
package/src/highlight.ts CHANGED
@@ -18,8 +18,6 @@ export function loadPrismReactRenderer(): PrismReactRendererModule | null {
18
18
  prismReactRenderer = null;
19
19
  }
20
20
  }
21
- // `?? null`: with the real peer types installed, TypeScript keeps `undefined`
22
- // in the type after the `try` (the package typecheck only sees a stub).
23
21
  return prismReactRenderer ?? null;
24
22
  }
25
23
 
@@ -66,7 +64,6 @@ export const GITHUB_CODE_COLORS: Record<"light" | "dark", Record<CodeColorRole,
66
64
  },
67
65
  };
68
66
 
69
- /** Prism token types to their GitHub role. Types not listed are plain. */
70
67
  const PRISM_ROLE: Record<string, CodeColorRole> = {
71
68
  comment: "comment",
72
69
  prolog: "comment",
@@ -132,20 +129,16 @@ export const SCRIPT_LANGUAGES = new Set(["js", "jsx", "javascript", "mjs", "cjs"
132
129
  /** Languages `shellTokens` colours. `prism-react-renderer` bundles no shell grammar. */
133
130
  export const SHELL_LANGUAGES = new Set(["bash", "sh", "shell", "zsh", "shellscript", "console"]);
134
131
 
135
- /** Keywords Shiki colours as constants (`constant.language`, `variable.language`, a `void` type). */
136
132
  const SCRIPT_CONSTANT_KEYWORDS = new Set(["null", "undefined", "this", "super", "void"]);
137
133
 
138
134
  const IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
139
135
 
140
- /** A token's role before context: what Prism's types say, with the Shiki differences that need no context. */
141
136
  function scriptBaseRole({ types, content }: PrismToken): CodeColorRole {
142
- // Inside `${…}` Shiki keeps the punctuation in the string colour and the code in its own.
143
137
  const interpolation = types.lastIndexOf("interpolation");
144
138
  if (interpolation >= 0) {
145
139
  const inner = types.slice(interpolation + 1);
146
140
  return inner.includes("punctuation") || inner.includes("interpolation-punctuation") ? "string" : prismRole(inner);
147
141
  }
148
- // A regex character class, brackets and escapes too.
149
142
  if (types.includes("char-class")) return "constant";
150
143
  const role = prismRole(types);
151
144
  if (role === "keyword" && SCRIPT_CONSTANT_KEYWORDS.has(content)) return "constant";
@@ -156,7 +149,6 @@ function scriptBaseRole({ types, content }: PrismToken): CodeColorRole {
156
149
 
157
150
  type Piece = CodeToken & { line: number; types: readonly string[] };
158
151
 
159
- /** Splits a token so escapes in strings and each word of plain text get a role of their own. */
160
152
  function splitPiece(piece: Piece): Piece[] {
161
153
  const parts =
162
154
  piece.role === "string" && !piece.types.includes("regex")
@@ -186,7 +178,6 @@ export function scriptTokens(lines: readonly (readonly PrismToken[])[]): CodeTok
186
178
  splitPiece({ content: token.content, types: token.types, role: scriptBaseRole(token), line }),
187
179
  ),
188
180
  );
189
- // Indices of the pieces that are not whitespace.
190
181
  const sig = pieces.flatMap((piece, index) => (piece.content.trim() === "" ? [] : [index]));
191
182
  const at = (position: number) => {
192
183
  const index = sig[position];
@@ -206,7 +197,6 @@ export function scriptTokens(lines: readonly (readonly PrismToken[])[]): CodeTok
206
197
  }
207
198
  return undefined;
208
199
  };
209
- // An arrow function's parameters, or a declared function's or method's.
210
200
  const isParameterList = (open: number, close: number) => {
211
201
  const before = at(open - 1);
212
202
  if (isWord(before, "function") || isWord(before, "constructor")) return true;
@@ -244,7 +234,6 @@ export function scriptTokens(lines: readonly (readonly PrismToken[])[]): CodeTok
244
234
  }
245
235
  let inImport = false;
246
236
  let constPattern = 0;
247
- // `Map<string, number>`: Shiki draws type-argument brackets plain, Prism as operators.
248
237
  let generic = 0;
249
238
  for (let position = 0; position < sig.length; position += 1) {
250
239
  const piece = at(position);
@@ -252,7 +241,6 @@ export function scriptTokens(lines: readonly (readonly PrismToken[])[]): CodeTok
252
241
  const previous = at(position - 1);
253
242
  if (piece.role === "keyword" && piece.content === "import") inImport = true;
254
243
  if (piece.role === "keyword" && piece.content === "from") inImport = false;
255
- // `const { a, b } = …`: every name in the pattern.
256
244
  if (isWord(previous, "const") && (piece.content === "{" || piece.content === "[")) constPattern = 1;
257
245
  else if (constPattern > 0 && (piece.content === "{" || piece.content === "[")) constPattern += 1;
258
246
  else if (constPattern > 0 && (piece.content === "}" || piece.content === "]")) constPattern -= 1;
@@ -285,16 +273,13 @@ function mergeLines(pieces: ReadonlyArray<CodeToken & { line: number }>, count:
285
273
  return out;
286
274
  }
287
275
 
288
- /** Shell words Shiki colours as keywords. */
289
276
  const SHELL_KEYWORDS = new Set([
290
277
  "if", "then", "else", "elif", "fi", "for", "while", "until", "do", "done", "case", "esac", "in",
291
278
  "function", "select", "break", "continue", "return", "export", "local", "readonly", "declare",
292
279
  ]);
293
280
 
294
- /** After these a new command starts. */
295
281
  const SHELL_COMMAND_KEYWORDS = new Set(["then", "else", "do", "if", "while", "until", "elif"]);
296
282
 
297
- /** Shell builtins Shiki colours as constants (`support.function.builtin`). */
298
283
  const SHELL_BUILTINS = new Set([
299
284
  "echo", "cd", "printf", "source", "set", "unset", "exit", "pwd", "read", "eval", "exec", "shift",
300
285
  "trap", "wait", "type", "alias", "unalias", "true", "false", "test", "ulimit", "umask", "kill",
@@ -319,9 +304,7 @@ export function shellTokens(code: string): CodeToken[][] {
319
304
  };
320
305
  let index = 0;
321
306
  let command = true;
322
- // `for NAME in`: the name is plain, then `in` is a keyword.
323
307
  let forState: "none" | "name" | "in" = "none";
324
- // Inside `[ … ]` Shiki draws test operators (`-f`) as keywords and words plain.
325
308
  let inTest = false;
326
309
  while (index < source.length) {
327
310
  const rest = source.slice(index);
@@ -336,7 +319,6 @@ export function shellTokens(code: string): CodeToken[][] {
336
319
  break;
337
320
  }
338
321
  if (rest.startsWith('"')) {
339
- // Double quotes: the string colour, with `$VAR` and `${VAR}` names plain.
340
322
  const end = rest.slice(1).search(/(?<!\\)"/);
341
323
  const text = end < 0 ? rest : rest.slice(0, end + 2);
342
324
  for (const part of text.split(/(\$\{[^}]*\}|\$[A-Za-z_]\w*)/)) {
@@ -362,7 +344,6 @@ export function shellTokens(code: string): CodeToken[][] {
362
344
  const operator = /^(?:\d?>>?&?\d?|<|\|\||\||&&|;|&|\$\(|\(|\)|`)/.exec(rest);
363
345
  if (operator) {
364
346
  const text = operator[0];
365
- // Shiki: `|`, `||` and redirects in the keyword colour, `&&` and `;` plain.
366
347
  push(text, text === "&&" || text === ";" || text === "$(" || text === "(" || text === ")" || text === "`" ? "plain" : "keyword");
367
348
  index += text.length;
368
349
  command = text !== ")" && !/^\d?>/.test(text) && text !== "<";
@@ -384,7 +365,6 @@ export function shellTokens(code: string): CodeToken[][] {
384
365
  forState = word === "for" ? "name" : "none";
385
366
  continue;
386
367
  }
387
- // A test's brackets are plain, and what follows them is not a command.
388
368
  if (word === "[" || word === "[[" || word === "]" || word === "]]") {
389
369
  push(word, "plain");
390
370
  command = false;
package/src/index.ts CHANGED
@@ -5,9 +5,10 @@ export {
5
5
  useNativeUi,
6
6
  useLargerText,
7
7
  useAccentColor,
8
+ useSurface,
8
9
  DEFAULT_ACCENT,
9
10
  } from "./theme";
10
- export type { NativeUiTheme } from "./theme";
11
+ export type { NativeUiTheme, NativeUiSurface } from "./theme";
11
12
  export { palette, withAlpha } from "./palette";
12
13
  export type { Palette } from "./palette";
13
14
  export { configureTheme } from "./configureTheme";
@@ -271,7 +272,6 @@ export type {
271
272
  ProjectVLinking,
272
273
  } from "./settings/projectVMobileApps";
273
274
  export { PINK_50, PINK_100, PINK_600, PINK_700, NEUTRAL_100, NEUTRAL_500, NEUTRAL_900, Colors } from "./colors";
274
- // Family app marks and their pure data (copied from `@vvedantb/ui/brand`), and `GoogleMark`.
275
275
  export * from "./brand";
276
276
  export { UpgradeToProCard } from "./marketing/UpgradeToProCard";
277
277
  export type { UpgradeToProCardProps } from "./marketing/UpgradeToProCard";
@@ -1,17 +1,6 @@
1
- /**
2
- * The web `LoadingState` `Drive` pixel grid (`packages/ui/src/ui/loading-state.tsx`)
3
- * as plain numbers, so the timing stays testable apart from Reanimated. Each
4
- * function is a worklet: the grid runs it on the UI thread every frame.
5
- *
6
- * Nine cells in a 3x3 grid pulse in a chevron wavefront that drives right.
7
- * The 650 ms cycle is shorter than the sweep (0-360 ms of delays), so two
8
- * fronts are always in flight.
9
- */
10
-
11
1
  /** One pulse of a cell, in ms: the web `PATTERNS.Drive.dur`. */
12
2
  export const DRIVE_CYCLE_MS = 650;
13
3
 
14
- /** A cell's opacity at the low and high keyframes. */
15
4
  const LOW = 0.12;
16
5
  const HIGH = 1;
17
6
  /** A cell's still opacity before its delay ends: the web inline `opacity: 0.15`. */
@@ -45,7 +34,6 @@ export function cssEaseInOut(x: number): number {
45
34
  "worklet";
46
35
  if (x <= 0) return 0;
47
36
  if (x >= 1) return 1;
48
- // x(t) = 3(1-t)^2 t x1 + 3(1-t) t^2 x2 + t^3 rises with t, so bisect for t.
49
37
  const curve = (t: number, p1: number, p2: number) =>
50
38
  3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t;
51
39
  let lo = 0;
@@ -30,29 +30,11 @@ export const MARKDOWN_SCALE = {
30
30
  } as const;
31
31
 
32
32
  export type MarkdownProps = {
33
- /** The markdown source. */
34
33
  children: string;
35
- /** With it, fenced code blocks get a copy button (native-ui adds no clipboard package). */
36
34
  onCopyCode?: (code: string) => void | Promise<void>;
37
- /** With it, tables get the web Copy table button: the table as Markdown, CSV or TSV. */
38
35
  onCopyTable?: (text: string) => void | Promise<void>;
39
- /**
40
- * Body line height. Default `relaxed`, the web `.markdown` 1.625 (14 / 22.75).
41
- * `normal` is the text size's own (14 / 20), as a web `Markdown` with
42
- * `text-sm` on it: Eva's user bubbles.
43
- */
44
36
  leading?: "relaxed" | "normal";
45
- /**
46
- * Draws a link your way (an app's mention chip): called with the link's
47
- * href and plain text; return undefined to keep the default link.
48
- */
49
37
  renderLink?: (href: string, text: string) => ReactNode | undefined;
50
- /**
51
- * Heading look. Default `default`, the web `.markdown` scale. `label`
52
- * demotes every heading to a quiet section label (`text-xs` medium,
53
- * uppercase, `tracking-wide`, muted, 16 above and 8 below), as a digest
54
- * of short themed lists (Eva's standup cards) styles its `###` headings.
55
- */
56
38
  headings?: MarkdownHeadings;
57
39
  };
58
40
 
@@ -88,9 +70,6 @@ export function Markdown({ children, onCopyCode, onCopyTable, leading = "relaxed
88
70
  },
89
71
  styles: markdownStyles(scheme, body, color, headings),
90
72
  });
91
- // Every block has half the gap above and below (React Native margins do not
92
- // collapse), so 16 between blocks; this takes the outer halves off, as the
93
- // web `first-child:mt-0` and `last-child:mb-0`.
94
73
  return <View style={{ marginVertical: -MARKDOWN_SCALE.blockGap / 2 }}>{elements}</View>;
95
74
  }
96
75
 
@@ -108,8 +87,6 @@ export function markdownStyles(
108
87
  ...trackingStyle(12, "wide"),
109
88
  textTransform: "uppercase",
110
89
  color: tokens.color.muted[scheme],
111
- // With the half gap each block keeps (margins do not collapse): 16 above,
112
- // the next block's 8 below (the web `mt-4 mb-1.5`, collapsed).
113
90
  marginTop: MARKDOWN_SCALE.blockGap / 2,
114
91
  marginBottom: 0,
115
92
  paddingBottom: 0,
@@ -123,14 +100,11 @@ export function markdownStyles(
123
100
  letterSpacing: -0.01 * body.fontSize * scale,
124
101
  color,
125
102
  marginVertical: MARKDOWN_SCALE.blockGap / 2,
126
- // `react-native-marked` rules h1 and h2 off; the web has no rule.
127
103
  paddingBottom: 0,
128
104
  borderBottomWidth: 0,
129
105
  });
130
106
  const heading = (scale: number): TextStyle => (headings === "label" ? label : scaled(scale));
131
107
  const gap = { marginVertical: MARKDOWN_SCALE.blockGap / 2 };
132
- // The library's inline styles start from its own 16 / 24 text, so each one
133
- // restates the body size, or a bold or linked word grows the line.
134
108
  const inline = { fontSize: body.fontSize, lineHeight: body.lineHeight };
135
109
  return {
136
110
  text: { fontFamily: fontFamily.regular, ...inline, color },
@@ -180,21 +154,12 @@ export function inlineCodeStyle(scheme: "light" | "dark", fontSize: number, colo
180
154
  };
181
155
  }
182
156
 
183
- /**
184
- * A paragraph block. A component of its own so `listItem` can find it in a
185
- * loose list (the parser's own paragraph is a plain `View`).
186
- */
187
157
  function Paragraph({ style, children }: { style?: StyleProp<ViewStyle>; children?: ReactNode }) {
188
158
  return <View style={style}>{children}</View>;
189
159
  }
190
160
 
191
161
  type StyledNodeProps ={ children?: ReactNode; style?: StyleProp<TextStyle>; accessibilityRole?: string };
192
162
 
193
- /**
194
- * An inline-code chip (see `codespan`). A component of its own so
195
- * `restyleText` can find it: NativeWind's JSX swaps a `Text` made in this
196
- * file for its own wrapper, so the type no longer equals `Text`.
197
- */
198
163
  function InlineCode({ style, children }: { style?: StyleProp<TextStyle>; children: string }) {
199
164
  return (
200
165
  <Text selectable style={style}>
@@ -203,12 +168,6 @@ function InlineCode({ style, children }: { style?: StyleProp<TextStyle>; childre
203
168
  );
204
169
  }
205
170
 
206
- /**
207
- * `node` with `map` applied to the style of every `Text` in it. The parser
208
- * bakes the text style into each `Text`, and React Native text takes no
209
- * style from a parent view, so a block that restyles its text (a quote, a
210
- * table) rewrites it here. Links keep their own style.
211
- */
212
171
  function restyleText(node: ReactNode, map: (style: TextStyle) => TextStyle): ReactNode {
213
172
  return Children.map(node, (child) => {
214
173
  if (!isValidElement<StyledNodeProps>(child)) return child;
@@ -221,7 +180,6 @@ function restyleText(node: ReactNode, map: (style: TextStyle) => TextStyle): Rea
221
180
  });
222
181
  }
223
182
 
224
- /** A link's text with its styling stripped: the strings in it, in order. */
225
183
  function plainText(node: ReactNode): string {
226
184
  let out = "";
227
185
  Children.forEach(node, (child) => {
@@ -231,10 +189,6 @@ function plainText(node: ReactNode): string {
231
189
  return out;
232
190
  }
233
191
 
234
- /**
235
- * A cell's plain text, as the web reads a cell's `textContent` for Copy
236
- * table: inline code without the no-break spaces that pad its chip.
237
- */
238
192
  function cellText(cell: ReactNode): string {
239
193
  return nodeText(cell).trim();
240
194
  }
@@ -253,12 +207,6 @@ function nodeText(node: ReactNode): string {
253
207
  /** Web `.markdown` lists: 1.25rem (20) indent, 0.25rem (4) between items, muted markers (a 5-wide disc). */
254
208
  export const MARKDOWN_LIST = { indent: 20, itemGap: 4, disc: 5 } as const;
255
209
 
256
- /**
257
- * `react-native-marked`'s renderer with native-ui code and lists: `CodeBlock`
258
- * panels, inline-code chips, and lists drawn as the web `.markdown` lists
259
- * (the library's own markers apply its marker style to every item). Links,
260
- * quotes and tables are drawn here too.
261
- */
262
210
  class NativeUiMarkdownRenderer extends Renderer {
263
211
  constructor(
264
212
  private readonly scheme: "light" | "dark",
@@ -271,11 +219,6 @@ class NativeUiMarkdownRenderer extends Renderer {
271
219
  super();
272
220
  }
273
221
 
274
- /**
275
- * Web `.markdown-link`, medium weight. The parser gives a link the
276
- * paragraph's regular face, so the face is set here, on the link and the
277
- * text in it.
278
- */
279
222
  override link(children: string | ReactNode[], href: string, styles?: TextStyle, title?: string): ReactNode {
280
223
  const custom = this.renderLink?.(href, plainText(children));
281
224
  if (custom !== undefined) return <Fragment key={this.getKey()}>{custom}</Fragment>;
@@ -284,10 +227,8 @@ class NativeUiMarkdownRenderer extends Renderer {
284
227
  return super.link(content, href, medium(styles ?? {}), title);
285
228
  }
286
229
 
287
- /** Web `.markdown blockquote`: the left rule, and the text in the muted colour. */
288
230
  override blockquote(children: ReactNode[], styles?: ViewStyle): ReactNode {
289
231
  const muted = tokens.color.muted[this.scheme];
290
- // The inner blocks' outer margins come off, as web margins collapse into the quote's.
291
232
  return (
292
233
  <View key={this.getKey()} style={styles}>
293
234
  <View style={{ marginVertical: -MARKDOWN_SCALE.blockGap / 2 }}>
@@ -297,15 +238,10 @@ class NativeUiMarkdownRenderer extends Renderer {
297
238
  );
298
239
  }
299
240
 
300
- /**
301
- * The web table on its panel (`MarkdownTable`): header cells semibold,
302
- * rows split by a 70% border, and the table actions above it.
303
- */
304
241
  override table(header: ReactNode[][], rows: ReactNode[][][]): ReactNode {
305
242
  const { fontScale, lineHeight } = MARKDOWN_TABLE;
306
243
  const small = (style: TextStyle): TextStyle => {
307
244
  const size = typeof style.fontSize === "number" ? style.fontSize * fontScale : this.fontSize * fontScale;
308
- // Body text takes the table line height; inline code keeps its own.
309
245
  return style.fontFamily === MONO_FONT
310
246
  ? { ...style, fontSize: size }
311
247
  : { ...style, fontSize: size, lineHeight: size * lineHeight };
@@ -332,11 +268,6 @@ class NativeUiMarkdownRenderer extends Renderer {
332
268
  );
333
269
  }
334
270
 
335
- /**
336
- * A loose list (items a blank line apart, as Eva's doc editor writes them)
337
- * puts each item's text in a paragraph. Its outer margins come off, as in
338
- * a quote, so the text sits on the marker's line, as the tight list.
339
- */
340
271
  override listItem(children: ReactNode[], styles?: ViewStyle): ReactNode {
341
272
  const loose = children.some((child) => isValidElement(child) && child.type === Paragraph);
342
273
  if (!loose) return super.listItem(children, styles);
@@ -352,7 +283,6 @@ class NativeUiMarkdownRenderer extends Renderer {
352
283
  }
353
284
 
354
285
  override codespan(text: string): ReactNode {
355
- // Text in Text takes no padding: no-break spaces pad the chip and keep it on one line.
356
286
  return (
357
287
  <InlineCode key={this.getKey()} style={inlineCodeStyle(this.scheme, this.fontSize, this.color)}>
358
288
  {`\u00A0${text}\u00A0`}
@@ -369,7 +299,6 @@ class NativeUiMarkdownRenderer extends Renderer {
369
299
  ): ReactNode {
370
300
  const muted = tokens.color.muted[this.scheme];
371
301
  const lineHeight = typeof textStyle?.lineHeight === "number" ? textStyle.lineHeight : 24;
372
- // A drawn disc: the font's bullet glyph is far smaller than the web `disc` marker.
373
302
  const disc = MARKDOWN_LIST.disc;
374
303
  return (
375
304
  <View key={this.getKey()} style={{ marginVertical: MARKDOWN_SCALE.blockGap / 2, gap: MARKDOWN_LIST.itemGap }}>
@@ -30,23 +30,12 @@ export const MARKDOWN_TABLE = {
30
30
  cellPaddingY: 7,
31
31
  panelPadding: { top: 4, x: 5, bottom: 6 },
32
32
  tableMargin: 10,
33
- /** The web action row: 24 buttons in a 27 row. */
34
33
  actionsHeight: 27,
35
- /**
36
- * The web buttons sit 4 apart; here 16, so each slops to 44 without
37
- * taking its neighbour's taps.
38
- */
39
34
  actionsGap: 16,
40
35
  } as const;
41
36
 
42
- /**
43
- * The full-screen table sizes each column to its text, as the web table does
44
- * (`markdownTableColumnWidths`). 8.5 a character fits the 12 mono of inline
45
- * code with its chip padding, so a code cell does not wrap; body text is narrower.
46
- */
47
37
  const FULL_SCREEN_COLUMN = { charWidth: 8.5, min: 72, max: 320 } as const;
48
38
 
49
- /** The web Copy table menu, in its order. */
50
39
  const COPY_FORMATS: ReadonlyArray<{ format: MarkdownTableFormat; title: string }> = [
51
40
  { format: "markdown", title: "Markdown" },
52
41
  { format: "csv", title: "CSV" },
@@ -54,27 +43,16 @@ const COPY_FORMATS: ReadonlyArray<{ format: MarkdownTableFormat; title: string }
54
43
  ];
55
44
 
56
45
  export type MarkdownTableProps = {
57
- /** Header cells, already styled. */
58
46
  header: ReactNode[];
59
- /** Body rows of cells, already styled. */
60
47
  rows: ReactNode[][];
61
- /** The same cells as plain text, for copying and for the full-screen column widths. */
62
48
  data: MarkdownTableData;
63
- /** The cell text colour. */
64
49
  color: string;
65
- /** With it, a Copy table button: a sheet of the web formats (Markdown, CSV, TSV). */
66
50
  onCopy?: (text: string) => void | Promise<void>;
67
51
  };
68
52
 
69
- /**
70
- * The cells as rows. `widths` gives every column its own width (the
71
- * full-screen view, which scrolls sideways); without it the columns share the
72
- * width equally and the cells wrap, so they line up in a chat column.
73
- */
74
53
  function TableRows({ header, rows, color, widths }: Pick<MarkdownTableProps, "header" | "rows" | "color"> & { widths?: number[] }) {
75
54
  const scheme = useScheme();
76
55
  const { cellPaddingX, cellPaddingY } = MARKDOWN_TABLE;
77
- // The header row is ruled off in the border colour, body rows at 70%.
78
56
  const rule = (index: number) => (index === 1 ? tokens.color.border[scheme] : withAlpha(tokens.color.border[scheme], 0.7));
79
57
  const row = (cells: ReactNode[], index: number) => (
80
58
  <View key={index} style={{ flexDirection: "row", borderTopWidth: index > 0 ? 1 : 0, borderTopColor: rule(index) }}>
@@ -167,7 +145,6 @@ export function MarkdownTable({ header, rows, data, color, onCopy }: MarkdownTab
167
145
  paddingRight: insets.right,
168
146
  }}
169
147
  >
170
- {/* Web: the actions top right, Exit fullscreen last. */}
171
148
  <View className="flex-row items-center justify-end px-2 py-1.5" style={{ gap: actionsGap }}>
172
149
  {copyButton}
173
150
  <ChatIconButton icon={IconX} label="Exit fullscreen" iconColor={muted} onPress={() => setFullScreen(false)} />
@@ -7,13 +7,11 @@ export type MarkdownTableData = { headers: string[]; rows: string[][] };
7
7
 
8
8
  export type MarkdownTableFormat = "markdown" | "csv" | "tsv";
9
9
 
10
- /** CSV: a cell with a comma, quote or line break is quoted, its quotes doubled. Lines join with `\n`. */
11
10
  function toCsv({ headers, rows }: MarkdownTableData): string {
12
11
  const cell = (text: string) => (/[",\n\r]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text);
13
12
  return [...(headers.length > 0 ? [headers] : []), ...rows].map((row) => row.map(cell).join(",")).join("\n");
14
13
  }
15
14
 
16
- /** TSV: tabs and line breaks in a cell are written as `\t`, `\n` and `\r`. */
17
15
  function toTsv({ headers, rows }: MarkdownTableData): string {
18
16
  const cell = (text: string) => text.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
19
17
  return [...(headers.length > 0 ? [headers] : []), ...rows].map((row) => row.map(cell).join("\t")).join("\n");
@@ -21,7 +19,6 @@ function toTsv({ headers, rows }: MarkdownTableData): string {
21
19
 
22
20
  const MARKDOWN_ESCAPES: Record<string, string> = { "\\": "\\\\", "|": "\\|", "\n": "<br>", "&": "&amp;", "<": "&lt;", ">": "&gt;" };
23
21
 
24
- /** GitHub markdown: pipes and backslashes escaped, line breaks as `<br>`, short rows padded to the header. */
25
22
  function toMarkdown({ headers, rows }: MarkdownTableData): string {
26
23
  if (headers.length === 0) return "";
27
24
  const cell = (text: string) => text.replace(/[\\|\n&<>]/g, (char) => MARKDOWN_ESCAPES[char] ?? char);
@@ -33,35 +33,23 @@ import {
33
33
 
34
34
  export type PricingModalProps = {
35
35
  open: boolean;
36
- /** Called by the close button and Android back (and an iOS swipe-down). */
37
36
  onClose: () => void;
38
- /** Accessible title, read first. Not visible. */
39
37
  title: string;
40
- /** Accessible description. Not visible. */
41
38
  description?: string;
42
- /** Cards, top to bottom. */
43
39
  plans: readonly PricingPlan[];
44
- /** App marks at the top left. Family apps only: each links to its `FAMILY_APPS` site. */
45
40
  apps?: readonly FamilyAppName[];
46
- /** App the modal is shown in. Its `appBenefits` group comes first. */
47
41
  currentApp?: ProductAppName;
48
- /** Centred headline, for example "One plan. Every V app." */
49
42
  headline?: ReactNode;
50
- /** Small print under the cards. */
51
43
  finePrint?: ReactNode;
52
44
  billingPeriod?: PricingModalPeriod;
53
45
  onBillingPeriodChange?: (period: PricingModalPeriod) => void;
54
- /** Default `"month"`. */
55
46
  defaultBillingPeriod?: PricingModalPeriod;
56
- /** Called by a plan's button. Not called for the `current` plan. Route it to the store's purchase flow. */
57
47
  onCheckout?: (plan: PricingPlan, period: PricingModalPeriod) => void;
58
- /** Wraps each plan's button (the web `renderCheckout`). The button already calls `onCheckout`. Not called for the `current` plan. */
59
48
  renderCheckout?: (
60
49
  button: ReactElement,
61
50
  plan: PricingPlan,
62
51
  period: PricingModalPeriod,
63
52
  ) => ReactNode;
64
- /** Called when an app mark is pressed. Without it the marks are not pressable. */
65
53
  onAppPress?: (app: AppName, url: string) => void;
66
54
  testID?: string;
67
55
  };
@@ -117,7 +105,6 @@ export function PricingModal({
117
105
  paddingBottom: insets.bottom,
118
106
  }}
119
107
  >
120
- {/* The web `sr-only` DialogTitle: a visually hidden header. */}
121
108
  <View
122
109
  accessible
123
110
  accessibilityRole="header"
@@ -5,25 +5,14 @@ import { tokens } from "../tokens";
5
5
  import { useLargerText } from "../theme";
6
6
  import { useScheme } from "../useScheme";
7
7
 
8
- /** Web `rounded-2xl` (16) on the card. */
9
8
  const RADIUS = tokens.radius.lg;
10
9
 
11
- // The web `Button` `sm` (`h-8 px-3 text-xs`) uses `max-sm:hit-target`, 8 on
12
- // each side: 32 + 16 = 48, as the native `Button` `small`.
13
10
  const HIT_SLOP = 8;
14
11
 
15
12
  export type UpgradeToProCardProps = {
16
- /** Opens the app's `PricingModal`. */
17
13
  onUpgrade: () => void;
18
- /**
19
- * A "Pro" pill (labelled with `title`) instead of the full card. Like the
20
- * web `Button` it stretches across a column and fits its label in a row.
21
- * Default `false`.
22
- */
23
14
  collapsed?: boolean;
24
- /** Default "Upgrade to Pro". */
25
15
  title?: string;
26
- /** Default "Upgrade". */
27
16
  ctaLabel?: string;
28
17
  className?: string;
29
18
  testID?: string;
@@ -44,11 +33,8 @@ export function UpgradeToProCard({
44
33
  }: UpgradeToProCardProps) {
45
34
  const scheme = useScheme();
46
35
  const largerText = useLargerText();
47
- // Each class is also set as a style (`sizeStyle`): web `text-sm` is 14 / 20.
48
36
  const titleSize = largerText ? "text-lg" : "text-sm";
49
37
  const ctaSize = largerText ? "text-base" : "text-sm";
50
- // The web pill is a `Button` `sm` (`font-medium`) in `bg-foreground text-background`,
51
- // at the phone `Button` `sm` size: 36 high with a 14 label (the web h-8 `text-xs`).
52
38
  const pill = (label: string, accessibilityLabel?: string) => (
53
39
  <Pressable
54
40
  testID={testID ? `${testID}-cta` : undefined}
@@ -1,5 +1,3 @@
1
- // Plan types and pure helpers for `PricingModal`, the same shapes and rules as
2
- // the web `PricingModal` multi-plan layout. No React Native imports.
3
1
  import type { ReactNode } from "react";
4
2
  import type { AppName } from "../brand/svg";
5
3
  import { V_PRO_APP_BENEFITS, type PricingPlanAppBenefit } from "../brand/vProAppBenefits";
@@ -8,32 +6,22 @@ export type PricingModalPeriod = "month" | "year";
8
6
 
9
7
  export type PricingPlanBenefit = {
10
8
  label: ReactNode;
11
- /** `"check"` (default) or an app mark. */
12
9
  icon?: "check" | AppName;
13
- /** Dimmed row. */
14
10
  muted?: boolean;
15
11
  };
16
12
 
17
13
  export type PricingPlan = {
18
14
  id: string;
19
15
  name: string;
20
- /** Display strings per month, for example `{ month: "$10", year: "$8" }`. The yearly price is still per month. */
21
16
  price: { month: string; year: string };
22
- /** Default "Get started". */
23
17
  ctaLabel?: string;
24
- /** Line above the highlight, for example "Everything in Free, and:". */
25
18
  intro?: ReactNode;
26
- /** Large title with small text under it. */
27
19
  highlight?: { title: string; description: string };
28
20
  benefits?: readonly PricingPlanBenefit[];
29
- /** Grouped per app, after `benefits`. The featured plan defaults to `V_PRO_APP_BENEFITS`. */
30
21
  appBenefits?: readonly PricingPlanAppBenefit[];
31
- /** The plan the user is on: the button reads "Current plan" and is disabled. */
32
22
  current?: boolean;
33
- /** Subtle ring on the card. `highlighted` is an alias. */
34
23
  featured?: boolean;
35
24
  highlighted?: boolean;
36
- /** Text after the price. Default "/month". */
37
25
  periodSuffix?: string;
38
26
  };
39
27