glacia-native 0.5.1 → 0.6.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 (403) hide show
  1. package/LICENSE +29 -4
  2. package/README.md +111 -17
  3. package/lib/module/Accordion.js +58 -0
  4. package/lib/module/ActionSheet.js +38 -0
  5. package/lib/module/Alert.js +23 -0
  6. package/lib/module/AlertDialog.js +47 -0
  7. package/lib/module/Avatar.js +48 -0
  8. package/lib/module/Badge.js +36 -0
  9. package/lib/module/Bars.js +13 -267
  10. package/lib/module/Button.js +57 -36
  11. package/lib/module/Card.js +32 -20
  12. package/lib/module/Checkbox.js +42 -0
  13. package/lib/module/Chip.js +80 -0
  14. package/lib/module/Collapsible.js +26 -0
  15. package/lib/module/ContextMenu.js +33 -0
  16. package/lib/module/Dialog.js +39 -124
  17. package/lib/module/DropdownMenu.js +33 -0
  18. package/lib/module/Field.js +22 -0
  19. package/lib/module/Glass.js +12 -5
  20. package/lib/module/Group.js +36 -0
  21. package/lib/module/IconButton.js +40 -0
  22. package/lib/module/Input.js +47 -40
  23. package/lib/module/Label.js +17 -0
  24. package/lib/module/MorphGroup.js +47 -0
  25. package/lib/module/Popover.js +29 -0
  26. package/lib/module/Progress.js +32 -0
  27. package/lib/module/RadioGroup.js +51 -0
  28. package/lib/module/Scrim.js +44 -0
  29. package/lib/module/SegmentedControl.js +74 -58
  30. package/lib/module/Select.js +51 -0
  31. package/lib/module/Separator.js +25 -0
  32. package/lib/module/Sheet.js +51 -0
  33. package/lib/module/Skeleton.js +48 -0
  34. package/lib/module/Slider.js +60 -40
  35. package/lib/module/Stepper.js +167 -0
  36. package/lib/module/Switch.js +45 -43
  37. package/lib/module/TabBar.js +62 -50
  38. package/lib/module/Tabs.js +3 -2
  39. package/lib/module/Textarea.js +18 -0
  40. package/lib/module/Toast.js +55 -0
  41. package/lib/module/Toggle.js +47 -0
  42. package/lib/module/ToggleGroup.js +56 -0
  43. package/lib/module/Toolbar.js +37 -0
  44. package/lib/module/Tooltip.js +31 -0
  45. package/lib/module/glass-provider.js +28 -0
  46. package/lib/module/glass-stack.js +61 -0
  47. package/lib/module/index.js +78 -109
  48. package/lib/module/internal/GlassBackdrop.js +36 -0
  49. package/lib/module/internal/GlassView.js +45 -13
  50. package/lib/module/internal/blur-community.js +20 -0
  51. package/lib/module/internal/blur-community.web.js +9 -0
  52. package/lib/module/internal/blur.js +75 -0
  53. package/lib/module/internal/fallback.js +110 -20
  54. package/lib/module/internal/glass-routing.js +154 -30
  55. package/lib/module/internal/glow.js +36 -0
  56. package/lib/module/internal/initials.js +12 -0
  57. package/lib/module/internal/lens.js +70 -0
  58. package/lib/module/internal/material.js +64 -0
  59. package/lib/module/internal/overlay.js +147 -0
  60. package/lib/module/internal/primitives.js +17 -0
  61. package/lib/module/internal/rim.js +35 -0
  62. package/lib/module/internal/tokens.js +34 -2
  63. package/lib/typescript/Accordion.d.ts +22 -0
  64. package/lib/typescript/ActionSheet.d.ts +24 -0
  65. package/lib/typescript/Alert.d.ts +15 -0
  66. package/lib/typescript/AlertDialog.d.ts +17 -0
  67. package/lib/typescript/Avatar.d.ts +22 -0
  68. package/lib/typescript/Badge.d.ts +12 -0
  69. package/lib/typescript/Bars.d.ts +3 -188
  70. package/lib/typescript/Button.d.ts +44 -10
  71. package/lib/typescript/Card.d.ts +30 -3
  72. package/lib/typescript/Checkbox.d.ts +14 -0
  73. package/lib/typescript/Chip.d.ts +19 -0
  74. package/lib/typescript/Collapsible.d.ts +17 -0
  75. package/lib/typescript/ContextMenu.d.ts +23 -0
  76. package/lib/typescript/Dialog.d.ts +8 -68
  77. package/lib/typescript/DropdownMenu.d.ts +23 -0
  78. package/lib/typescript/Field.d.ts +19 -0
  79. package/lib/typescript/Glass.d.ts +11 -2
  80. package/lib/typescript/Group.d.ts +35 -0
  81. package/lib/typescript/IconButton.d.ts +21 -0
  82. package/lib/typescript/Input.d.ts +17 -18
  83. package/lib/typescript/Label.d.ts +14 -0
  84. package/lib/typescript/MorphGroup.d.ts +46 -0
  85. package/lib/typescript/Popover.d.ts +17 -0
  86. package/lib/typescript/Progress.d.ts +13 -0
  87. package/lib/typescript/RadioGroup.d.ts +21 -0
  88. package/lib/typescript/Scrim.d.ts +33 -0
  89. package/lib/typescript/SegmentedControl.d.ts +24 -13
  90. package/lib/typescript/Select.d.ts +19 -0
  91. package/lib/typescript/Separator.d.ts +10 -0
  92. package/lib/typescript/Sheet.d.ts +45 -0
  93. package/lib/typescript/Skeleton.d.ts +10 -0
  94. package/lib/typescript/Slider.d.ts +15 -7
  95. package/lib/typescript/Stepper.d.ts +49 -0
  96. package/lib/typescript/Switch.d.ts +19 -12
  97. package/lib/typescript/TabBar.d.ts +18 -6
  98. package/lib/typescript/Textarea.d.ts +6 -0
  99. package/lib/typescript/Toast.d.ts +40 -0
  100. package/lib/typescript/Toggle.d.ts +21 -0
  101. package/lib/typescript/ToggleGroup.d.ts +22 -0
  102. package/lib/typescript/Toolbar.d.ts +35 -0
  103. package/lib/typescript/Tooltip.d.ts +16 -0
  104. package/lib/typescript/glass-provider.d.ts +34 -0
  105. package/lib/typescript/glass-stack.d.ts +54 -0
  106. package/lib/typescript/index.d.ts +39 -17
  107. package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
  108. package/lib/typescript/internal/GlassView.d.ts +31 -2
  109. package/lib/typescript/internal/blur-community.d.ts +2 -0
  110. package/lib/typescript/internal/blur-community.web.d.ts +2 -0
  111. package/lib/typescript/internal/blur.d.ts +24 -0
  112. package/lib/typescript/internal/fallback.d.ts +27 -2
  113. package/lib/typescript/internal/glass-routing.d.ts +83 -15
  114. package/lib/typescript/internal/glow.d.ts +11 -0
  115. package/lib/typescript/internal/initials.d.ts +2 -0
  116. package/lib/typescript/internal/lens.d.ts +47 -0
  117. package/lib/typescript/internal/material.d.ts +27 -0
  118. package/lib/typescript/internal/overlay.d.ts +74 -0
  119. package/lib/typescript/internal/primitives.d.ts +13 -0
  120. package/lib/typescript/internal/rim.d.ts +16 -0
  121. package/lib/typescript/internal/tokens.d.ts +36 -0
  122. package/package.json +15 -4
  123. package/src/Accordion.tsx +165 -0
  124. package/src/ActionSheet.tsx +149 -0
  125. package/src/Alert.tsx +85 -0
  126. package/src/AlertDialog.tsx +124 -0
  127. package/src/Avatar.tsx +102 -0
  128. package/src/Badge.tsx +80 -0
  129. package/src/Bars.tsx +10 -797
  130. package/src/Button.tsx +196 -60
  131. package/src/Card.tsx +106 -33
  132. package/src/Checkbox.tsx +98 -0
  133. package/src/Chip.tsx +149 -0
  134. package/src/Collapsible.tsx +66 -0
  135. package/src/ContextMenu.tsx +103 -0
  136. package/src/Dialog.tsx +86 -325
  137. package/src/DropdownMenu.tsx +103 -0
  138. package/src/Field.tsx +65 -0
  139. package/src/Glass.tsx +19 -5
  140. package/src/Group.tsx +98 -0
  141. package/src/IconButton.tsx +110 -0
  142. package/src/Input.tsx +143 -87
  143. package/src/Label.tsx +56 -0
  144. package/src/MorphGroup.tsx +134 -0
  145. package/src/Popover.tsx +81 -0
  146. package/src/Progress.tsx +83 -0
  147. package/src/RadioGroup.tsx +122 -0
  148. package/src/Scrim.tsx +94 -0
  149. package/src/SegmentedControl.tsx +147 -90
  150. package/src/Select.tsx +136 -0
  151. package/src/Separator.tsx +52 -0
  152. package/src/Sheet.tsx +139 -0
  153. package/src/Skeleton.tsx +77 -0
  154. package/src/Slider.tsx +100 -54
  155. package/src/Stepper.tsx +315 -0
  156. package/src/Switch.tsx +80 -58
  157. package/src/TabBar.tsx +118 -84
  158. package/src/Tabs.tsx +5 -0
  159. package/src/Textarea.tsx +34 -0
  160. package/src/Toast.tsx +131 -0
  161. package/src/Toggle.tsx +113 -0
  162. package/src/ToggleGroup.tsx +129 -0
  163. package/src/Toolbar.tsx +111 -0
  164. package/src/Tooltip.tsx +79 -0
  165. package/src/engine/CHANGELOG.md +430 -0
  166. package/src/engine/NOTICE +54 -0
  167. package/src/engine/README.md +975 -0
  168. package/src/engine/android/build.gradle +18 -0
  169. package/src/engine/android/src/main/AndroidManifest.xml +2 -0
  170. package/src/engine/android/src/main/java/expo/modules/liquidglass/ExpoLiquidGlassModule.kt +174 -0
  171. package/src/engine/android/src/main/java/expo/modules/liquidglass/GlassConstants.kt +7 -0
  172. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassContainerView.kt +16 -0
  173. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassProviderView.kt +165 -0
  174. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassView.kt +1731 -0
  175. package/src/engine/android/src/main/java/expo/modules/liquidglass/enums/GlassEnums.kt +171 -0
  176. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropGraph.kt +146 -0
  177. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropSource.kt +53 -0
  178. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ContinuousCorners.kt +188 -0
  179. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/CornerRadii.kt +62 -0
  180. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassAppearance.kt +352 -0
  181. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassDebug.kt +109 -0
  182. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassEnvironment.kt +139 -0
  183. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassHdr.kt +85 -0
  184. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassLuminanceProbe.kt +189 -0
  185. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassPressAnimator.kt +264 -0
  186. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassProgressiveBlur.kt +249 -0
  187. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderCache.kt +256 -0
  188. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderSource.kt +845 -0
  189. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassTier.kt +63 -0
  190. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ProviderRegistry.kt +71 -0
  191. package/src/engine/android/src/main/java/expo/modules/liquidglass/records/GlassRecords.kt +288 -0
  192. package/src/engine/index.ts +24 -0
  193. package/src/engine/ios/Enums/GlassBlurDirection.swift +21 -0
  194. package/src/engine/ios/Enums/GlassVariant.swift +86 -0
  195. package/src/engine/ios/ExpoLiquidGlass.podspec +93 -0
  196. package/src/engine/ios/ExpoLiquidGlassModule.swift +77 -0
  197. package/src/engine/ios/Glass/BackdropCapturer.swift +811 -0
  198. package/src/engine/ios/Glass/ContinuousCorners.swift +165 -0
  199. package/src/engine/ios/Glass/GlassBackdrop.swift +176 -0
  200. package/src/engine/ios/Glass/GlassFramePhase.swift +126 -0
  201. package/src/engine/ios/Glass/GlassFrameScheduler.swift +261 -0
  202. package/src/engine/ios/Glass/GlassPressAnimator.swift +250 -0
  203. package/src/engine/ios/Glass/GlassRenderContext.swift +168 -0
  204. package/src/engine/ios/Glass/GlassRenderer.swift +186 -0
  205. package/src/engine/ios/Glass/GlassSurfaceView.swift +452 -0
  206. package/src/engine/ios/Glass/NonRenderableView.swift +54 -0
  207. package/src/engine/ios/Glass/StripCache.swift +545 -0
  208. package/src/engine/ios/Records/GlassCornerRadii.swift +79 -0
  209. package/src/engine/ios/Records/GlassMetalOptions.swift +180 -0
  210. package/src/engine/ios/Records/GlassRefractionCurve.swift +14 -0
  211. package/src/engine/ios/Shaders/LiquidGlass.metal +480 -0
  212. package/src/engine/ios/Shaders/bundle-marker.txt +6 -0
  213. package/src/engine/ios/Views/LiquidGlassContainerView.swift +99 -0
  214. package/src/engine/ios/Views/LiquidGlassView.swift +859 -0
  215. package/src/engine/package.json +70 -0
  216. package/src/engine/src/components/LiquidGlassButton/LiquidGlassButton.tsx +424 -0
  217. package/src/engine/src/components/LiquidGlassCard/LiquidGlassCard.tsx +98 -0
  218. package/src/engine/src/components/LiquidGlassChip/LiquidGlassChip.tsx +65 -0
  219. package/src/engine/src/components/LiquidGlassGroup/LiquidGlassGroup.tsx +350 -0
  220. package/src/engine/src/components/LiquidGlassIconButton/LiquidGlassIconButton.tsx +24 -0
  221. package/src/engine/src/components/LiquidGlassMorphGroup/LiquidGlassMorphGroup.tsx +434 -0
  222. package/src/engine/src/components/LiquidGlassScrim/LiquidGlassScrim.tsx +100 -0
  223. package/src/engine/src/components/LiquidGlassSegmentedControl/LiquidGlassSegmentedControl.tsx +213 -0
  224. package/src/engine/src/components/LiquidGlassSheet/LiquidGlassSheet.tsx +218 -0
  225. package/src/engine/src/components/LiquidGlassSlider/LiquidGlassSlider.tsx +327 -0
  226. package/src/engine/src/components/LiquidGlassStepper/LiquidGlassStepper.tsx +321 -0
  227. package/src/engine/src/components/LiquidGlassSwitch/LiquidGlassSwitch.tsx +296 -0
  228. package/src/engine/src/components/LiquidGlassTabBar/LiquidGlassTabBar.tsx +952 -0
  229. package/src/engine/src/components/LiquidGlassTextInput/LiquidGlassTextInput.tsx +151 -0
  230. package/src/engine/src/components/LiquidGlassToast/LiquidGlassToast.tsx +169 -0
  231. package/src/engine/src/components/LiquidGlassToolbar/LiquidGlassToolbar.tsx +124 -0
  232. package/src/engine/src/components/index.ts +16 -0
  233. package/src/engine/src/constants/index.ts +4 -0
  234. package/src/engine/src/constants/metal.constants.ts +327 -0
  235. package/src/engine/src/constants/metrics.constants.ts +325 -0
  236. package/src/engine/src/constants/springs.constants.ts +107 -0
  237. package/src/engine/src/constants/styles.constants.ts +12 -0
  238. package/src/engine/src/context/glass-group.context.ts +65 -0
  239. package/src/engine/src/context/index.ts +6 -0
  240. package/src/engine/src/core/components/LiquidGlassContainer/LiquidGlassContainer.tsx +32 -0
  241. package/src/engine/src/core/components/LiquidGlassContainer/index.ts +1 -0
  242. package/src/engine/src/core/components/LiquidGlassProvider/LiquidGlassProvider.tsx +66 -0
  243. package/src/engine/src/core/components/LiquidGlassProvider/index.ts +1 -0
  244. package/src/engine/src/core/components/LiquidGlassStack/LiquidGlassStack.tsx +184 -0
  245. package/src/engine/src/core/components/LiquidGlassStack/index.ts +1 -0
  246. package/src/engine/src/core/components/LiquidGlassView/LiquidGlassView.tsx +126 -0
  247. package/src/engine/src/core/components/LiquidGlassView/index.ts +1 -0
  248. package/src/engine/src/core/components/index.ts +4 -0
  249. package/src/engine/src/core/constants/glass.constants.ts +57 -0
  250. package/src/engine/src/core/constants/index.ts +20 -0
  251. package/src/engine/src/core/constants/native.constants.ts +16 -0
  252. package/src/engine/src/core/context/glass-stack.context.ts +30 -0
  253. package/src/engine/src/core/context/index.ts +4 -0
  254. package/src/engine/src/core/enum/index.ts +12 -0
  255. package/src/engine/src/core/index.ts +1 -0
  256. package/src/engine/src/core/interfaces/glass-hdr.interface.ts +15 -0
  257. package/src/engine/src/core/interfaces/glass-metal.interface.ts +248 -0
  258. package/src/engine/src/core/interfaces/glass-surface.interface.ts +9 -0
  259. package/src/engine/src/core/interfaces/index.ts +31 -0
  260. package/src/engine/src/core/interfaces/liquid-glass-container.interface.ts +6 -0
  261. package/src/engine/src/core/interfaces/liquid-glass-provider.interface.ts +14 -0
  262. package/src/engine/src/core/interfaces/liquid-glass-stack.interface.ts +21 -0
  263. package/src/engine/src/core/interfaces/liquid-glass-view.interface.ts +129 -0
  264. package/src/engine/src/core/interfaces/native-liquid-glass-view.interface.ts +19 -0
  265. package/src/engine/src/core/modules/ExpoLiquidGlassModule.ts +26 -0
  266. package/src/engine/src/core/modules/index.ts +2 -0
  267. package/src/engine/src/core/root/index.ts +51 -0
  268. package/src/engine/src/core/types/glass.types.ts +25 -0
  269. package/src/engine/src/core/types/index.ts +8 -0
  270. package/src/engine/src/core/utils/debug.utils.ts +17 -0
  271. package/src/engine/src/core/utils/dev-warn.utils.ts +17 -0
  272. package/src/engine/src/core/utils/hdr.utils.ts +37 -0
  273. package/src/engine/src/core/utils/index.ts +5 -0
  274. package/src/engine/src/core/utils/native-view.utils.ts +33 -0
  275. package/src/engine/src/core/utils/platform.utils.ts +34 -0
  276. package/src/engine/src/core/views/NativeGlassBackdropView.ts +24 -0
  277. package/src/engine/src/core/views/NativeLiquidGlassContainerView.ts +13 -0
  278. package/src/engine/src/core/views/NativeLiquidGlassContainerView.web.ts +10 -0
  279. package/src/engine/src/core/views/NativeLiquidGlassProviderView.ts +13 -0
  280. package/src/engine/src/core/views/NativeLiquidGlassProviderView.web.ts +10 -0
  281. package/src/engine/src/core/views/NativeLiquidGlassView.ts +19 -0
  282. package/src/engine/src/core/views/NativeLiquidGlassView.web.ts +14 -0
  283. package/src/engine/src/core/views/index.ts +4 -0
  284. package/src/engine/src/hooks/index.ts +18 -0
  285. package/src/engine/src/hooks/use-adaptive-glass.ts +91 -0
  286. package/src/engine/src/hooks/use-damped-drag.ts +332 -0
  287. package/src/engine/src/hooks/use-echo-filter.ts +55 -0
  288. package/src/engine/src/hooks/use-glass-group-member.ts +169 -0
  289. package/src/engine/src/hooks/use-gravity-highlight.ts +79 -0
  290. package/src/engine/src/hooks/use-press-progress.ts +44 -0
  291. package/src/engine/src/index.ts +120 -0
  292. package/src/engine/src/interfaces/index.ts +28 -0
  293. package/src/engine/src/interfaces/liquid-glass-button.interface.ts +94 -0
  294. package/src/engine/src/interfaces/liquid-glass-card.interface.ts +40 -0
  295. package/src/engine/src/interfaces/liquid-glass-chip.interface.ts +29 -0
  296. package/src/engine/src/interfaces/liquid-glass-group.interface.ts +32 -0
  297. package/src/engine/src/interfaces/liquid-glass-icon-button.interface.ts +19 -0
  298. package/src/engine/src/interfaces/liquid-glass-morph-group.interface.ts +59 -0
  299. package/src/engine/src/interfaces/liquid-glass-scrim.interface.ts +36 -0
  300. package/src/engine/src/interfaces/liquid-glass-segmented-control.interface.ts +32 -0
  301. package/src/engine/src/interfaces/liquid-glass-sheet.interface.ts +38 -0
  302. package/src/engine/src/interfaces/liquid-glass-slider.interface.ts +37 -0
  303. package/src/engine/src/interfaces/liquid-glass-stepper.interface.ts +35 -0
  304. package/src/engine/src/interfaces/liquid-glass-switch.interface.ts +27 -0
  305. package/src/engine/src/interfaces/liquid-glass-tab-bar.interface.ts +116 -0
  306. package/src/engine/src/interfaces/liquid-glass-text-input.interface.ts +42 -0
  307. package/src/engine/src/interfaces/liquid-glass-toast.interface.ts +36 -0
  308. package/src/engine/src/interfaces/liquid-glass-toolbar.interface.ts +33 -0
  309. package/src/engine/src/theme/glass-ui-theme.ts +100 -0
  310. package/src/engine/src/theme/index.ts +2 -0
  311. package/src/engine/src/utils/button-press.utils.ts +63 -0
  312. package/src/engine/src/utils/index.ts +3 -0
  313. package/src/engine/src/utils/metal.utils.ts +164 -0
  314. package/src/glass-provider.tsx +60 -0
  315. package/src/glass-stack.tsx +115 -0
  316. package/src/index.ts +48 -190
  317. package/src/internal/GlassBackdrop.tsx +60 -0
  318. package/src/internal/GlassView.tsx +70 -18
  319. package/src/internal/blur-community.ts +19 -0
  320. package/src/internal/blur-community.web.ts +7 -0
  321. package/src/internal/blur.ts +89 -0
  322. package/src/internal/fallback.tsx +158 -20
  323. package/src/internal/glass-routing.ts +211 -34
  324. package/src/internal/glow.tsx +62 -0
  325. package/src/internal/initials.ts +7 -0
  326. package/src/internal/lens.tsx +105 -0
  327. package/src/internal/material.ts +92 -0
  328. package/src/internal/overlay.tsx +258 -0
  329. package/src/internal/primitives.ts +26 -0
  330. package/src/internal/rim.tsx +79 -0
  331. package/src/internal/tokens.ts +34 -1
  332. package/lib/module/Carousel.js +0 -103
  333. package/lib/module/Display.js +0 -317
  334. package/lib/module/Feedback.js +0 -386
  335. package/lib/module/Form.js +0 -164
  336. package/lib/module/Forms2.js +0 -454
  337. package/lib/module/Message.js +0 -88
  338. package/lib/module/Overlays.js +0 -328
  339. package/lib/module/Pickers.js +0 -243
  340. package/lib/module/Table.js +0 -99
  341. package/lib/module/ai.js +0 -280
  342. package/lib/module/charts/AreaChart.js +0 -32
  343. package/lib/module/charts/BarChart.js +0 -67
  344. package/lib/module/charts/FunnelChart.js +0 -50
  345. package/lib/module/charts/HeatmapChart.js +0 -71
  346. package/lib/module/charts/LineChart.js +0 -81
  347. package/lib/module/charts/PlotChart.js +0 -52
  348. package/lib/module/charts/RadarChart.js +0 -78
  349. package/lib/module/charts/RingChart.js +0 -52
  350. package/lib/module/charts/ScatterChart.js +0 -95
  351. package/lib/module/charts/WaterfallChart.js +0 -85
  352. package/lib/module/charts/advanced.js +0 -313
  353. package/lib/module/charts/extra.js +0 -108
  354. package/lib/module/charts/index.js +0 -50
  355. package/lib/module/charts/scales.js +0 -140
  356. package/lib/typescript/Carousel.d.ts +0 -47
  357. package/lib/typescript/Display.d.ts +0 -178
  358. package/lib/typescript/Feedback.d.ts +0 -196
  359. package/lib/typescript/Form.d.ts +0 -97
  360. package/lib/typescript/Forms2.d.ts +0 -209
  361. package/lib/typescript/Message.d.ts +0 -71
  362. package/lib/typescript/Overlays.d.ts +0 -146
  363. package/lib/typescript/Pickers.d.ts +0 -105
  364. package/lib/typescript/Table.d.ts +0 -64
  365. package/lib/typescript/ai.d.ts +0 -166
  366. package/lib/typescript/charts/AreaChart.d.ts +0 -44
  367. package/lib/typescript/charts/BarChart.d.ts +0 -19
  368. package/lib/typescript/charts/FunnelChart.d.ts +0 -25
  369. package/lib/typescript/charts/HeatmapChart.d.ts +0 -23
  370. package/lib/typescript/charts/LineChart.d.ts +0 -30
  371. package/lib/typescript/charts/PlotChart.d.ts +0 -31
  372. package/lib/typescript/charts/RadarChart.d.ts +0 -27
  373. package/lib/typescript/charts/RingChart.d.ts +0 -28
  374. package/lib/typescript/charts/ScatterChart.d.ts +0 -34
  375. package/lib/typescript/charts/WaterfallChart.d.ts +0 -22
  376. package/lib/typescript/charts/advanced.d.ts +0 -107
  377. package/lib/typescript/charts/extra.d.ts +0 -63
  378. package/lib/typescript/charts/index.d.ts +0 -13
  379. package/lib/typescript/charts/scales.d.ts +0 -35
  380. package/src/Carousel.tsx +0 -233
  381. package/src/Display.tsx +0 -778
  382. package/src/Feedback.tsx +0 -969
  383. package/src/Form.tsx +0 -425
  384. package/src/Forms2.tsx +0 -1014
  385. package/src/Message.tsx +0 -219
  386. package/src/Overlays.tsx +0 -685
  387. package/src/Pickers.tsx +0 -590
  388. package/src/Table.tsx +0 -231
  389. package/src/ai.tsx +0 -707
  390. package/src/charts/AreaChart.tsx +0 -73
  391. package/src/charts/BarChart.tsx +0 -183
  392. package/src/charts/FunnelChart.tsx +0 -125
  393. package/src/charts/HeatmapChart.tsx +0 -155
  394. package/src/charts/LineChart.tsx +0 -247
  395. package/src/charts/PlotChart.tsx +0 -168
  396. package/src/charts/RadarChart.tsx +0 -208
  397. package/src/charts/RingChart.tsx +0 -133
  398. package/src/charts/ScatterChart.tsx +0 -223
  399. package/src/charts/WaterfallChart.tsx +0 -201
  400. package/src/charts/advanced.tsx +0 -676
  401. package/src/charts/extra.tsx +0 -242
  402. package/src/charts/index.ts +0 -86
  403. package/src/charts/scales.ts +0 -163
package/src/ai.tsx DELETED
@@ -1,707 +0,0 @@
1
- import { useEffect, useState, type ReactNode } from "react";
2
- import type { StyleProp, ViewStyle } from "react-native";
3
-
4
- import { colors, radii } from "./internal/tokens";
5
- import { primitives } from "./internal/primitives";
6
- import { useIsDark } from "./internal/motion";
7
- import { useReducedMotion } from "./internal/a11y";
8
-
9
- export interface NativePlanStep {
10
- id: string;
11
- title: string;
12
- detail?: string;
13
- status: "pending" | "running" | "done" | "failed";
14
- }
15
-
16
- export interface NativePlanProps {
17
- title?: string;
18
- steps: NativePlanStep[];
19
- isDark?: boolean;
20
- style?: any;
21
- }
22
-
23
- /**
24
- * The ordered steps a model intends to take.
25
- *
26
- * Each step carries its own status, so a half-finished plan is legible instead
27
- * of appearing blank until the whole thing completes.
28
- */
29
- export function NativePlan({ title = "Plan", steps, isDark: isDarkProp, style }: NativePlanProps) {
30
- const isDark = useIsDark(isDarkProp);
31
- const theme = isDark ? colors.dark : colors.light;
32
- const { View, Text } = primitives();
33
- const done = steps.filter((step) => step.status === "done").length;
34
-
35
- const markerColor = (status: NativePlanStep["status"]) =>
36
- status === "done"
37
- ? "#34c759"
38
- : status === "failed"
39
- ? theme.destructive
40
- : status === "running"
41
- ? theme.fill
42
- : theme.muted;
43
-
44
- return (
45
- <View style={style}>
46
- <View
47
- style={{
48
- flexDirection: "row",
49
- justifyContent: "space-between",
50
- alignItems: "center",
51
- marginBottom: 8,
52
- }}
53
- >
54
- <Text style={{ fontSize: 13, fontWeight: "600", color: theme.foreground }}>{title}</Text>
55
- <Text style={{ fontSize: 11, color: theme.muted }}>
56
- {done}/{steps.length}
57
- </Text>
58
- </View>
59
-
60
- {steps.map((step) => (
61
- <View
62
- key={step.id}
63
- accessibilityRole="text"
64
- accessibilityLabel={`${step.title}: ${step.status}`}
65
- style={{ flexDirection: "row", alignItems: "flex-start", gap: 9, marginBottom: 8 }}
66
- >
67
- <View
68
- style={{
69
- width: 16,
70
- height: 16,
71
- borderRadius: 8,
72
- borderWidth: step.status === "pending" ? 1.5 : 0,
73
- borderColor: theme.edge,
74
- backgroundColor: step.status === "pending" ? "transparent" : markerColor(step.status),
75
- alignItems: "center",
76
- justifyContent: "center",
77
- marginTop: 1,
78
- }}
79
- >
80
- {step.status !== "pending" && (
81
- <Text style={{ fontSize: 9, color: "#fff", fontWeight: "700" }}>
82
- {step.status === "done" ? "✓" : step.status === "failed" ? "!" : "•"}
83
- </Text>
84
- )}
85
- </View>
86
-
87
- <View style={{ flex: 1 }}>
88
- <Text
89
- style={{
90
- fontSize: 13,
91
- color: step.status === "pending" ? theme.muted : theme.foreground,
92
- }}
93
- >
94
- {step.title}
95
- </Text>
96
- {step.detail && (
97
- <Text style={{ fontSize: 11, color: theme.muted, marginTop: 2 }}>{step.detail}</Text>
98
- )}
99
- </View>
100
- </View>
101
- ))}
102
- </View>
103
- );
104
- }
105
-
106
- export interface NativeSource {
107
- id: string;
108
- title: string;
109
- url: string;
110
- snippet?: string;
111
- domain?: string;
112
- }
113
-
114
- export interface NativeSourcesProps {
115
- sources: NativeSource[];
116
- title?: string;
117
- isDark?: boolean;
118
- style?: any;
119
- onSourcePress?: (source: NativeSource) => void;
120
- }
121
-
122
- /**
123
- * Citations behind an answer, so a claim can be traced to its origin.
124
- *
125
- * Native has no anchor element, so a row hands the source to the caller's
126
- * `onSourcePress` instead of opening a browser the component cannot control.
127
- */
128
- export function NativeSources({
129
- sources,
130
- title = "Sources",
131
- isDark: isDarkProp,
132
- style,
133
- onSourcePress,
134
- }: NativeSourcesProps) {
135
- const isDark = useIsDark(isDarkProp);
136
- const theme = isDark ? colors.dark : colors.light;
137
- const { View, Text, Pressable } = primitives();
138
-
139
- if (sources.length === 0) return null;
140
-
141
- return (
142
- <View style={style}>
143
- <Text style={{ fontSize: 11, fontWeight: "600", color: theme.muted, marginBottom: 6 }}>
144
- {title}
145
- </Text>
146
-
147
- {sources.map((source, index) => (
148
- <Pressable
149
- key={source.id}
150
- accessibilityRole="link"
151
- accessibilityLabel={source.title}
152
- onPress={() => onSourcePress?.(source)}
153
- style={{
154
- flexDirection: "row",
155
- gap: 9,
156
- paddingVertical: 7,
157
- paddingHorizontal: 10,
158
- borderRadius: radii.md,
159
- borderWidth: 1,
160
- borderColor: theme.edge,
161
- marginBottom: 6,
162
- }}
163
- >
164
- <Text style={{ fontSize: 10, color: theme.muted, marginTop: 1 }}>{index + 1}</Text>
165
- <View style={{ flex: 1 }}>
166
- <Text style={{ fontSize: 12, color: theme.foreground, fontWeight: "500" }}>
167
- {source.title}
168
- </Text>
169
- {source.snippet && (
170
- <Text style={{ fontSize: 11, color: theme.muted, marginTop: 2 }}>
171
- {source.snippet}
172
- </Text>
173
- )}
174
- {source.domain && (
175
- <Text style={{ fontSize: 10, color: theme.muted, marginTop: 3 }}>
176
- {source.domain}
177
- </Text>
178
- )}
179
- </View>
180
- </Pressable>
181
- ))}
182
- </View>
183
- );
184
- }
185
-
186
- export interface NativeResponseProps {
187
- text: string;
188
- /** Characters to reveal. Omit to show the whole string. */
189
- revealed?: number;
190
- streaming?: boolean;
191
- isDark?: boolean;
192
- style?: any;
193
- }
194
-
195
- /**
196
- * Text revealed progressively as a streamed answer arrives.
197
- *
198
- * The caller owns the streaming clock (usually a network stream); this only
199
- * renders the first `revealed` characters and shows a caret while incomplete.
200
- */
201
- export function NativeResponse({
202
- text,
203
- revealed,
204
- streaming,
205
- isDark: isDarkProp,
206
- style,
207
- }: NativeResponseProps) {
208
- const isDark = useIsDark(isDarkProp);
209
- const theme = isDark ? colors.dark : colors.light;
210
- const { View, Text } = primitives();
211
-
212
- const shown = revealed == null ? text : text.slice(0, Math.max(0, revealed));
213
- const isStreaming = streaming ?? (revealed != null && revealed < text.length);
214
-
215
- return (
216
- <View style={style}>
217
- <Text
218
- accessibilityRole="text"
219
- accessibilityLabel={shown}
220
- style={{ fontSize: 14, lineHeight: 21, color: theme.foreground }}
221
- >
222
- {shown}
223
- {isStreaming ? "▍" : ""}
224
- </Text>
225
- {/* Announced as a status so screen readers know it is still arriving. */}
226
- <Text accessibilityRole="alert" style={{ height: 0, opacity: 0, fontSize: 0 }}>
227
- {isStreaming ? "Response streaming" : "Response complete"}
228
- </Text>
229
- </View>
230
- );
231
- }
232
-
233
- export interface NativeTaskProps {
234
- task: {
235
- /** 0–1, or omit for an indeterminate task. */
236
- progress?: number;
237
- label?: string;
238
- detail?: string;
239
- status?: "running" | "done" | "failed" | "queued";
240
- };
241
- isDark?: boolean;
242
- style?: any;
243
- }
244
-
245
- /** Progress of a long-running background task. */
246
- export function NativeTask({ task, isDark: isDarkProp, style }: NativeTaskProps) {
247
- const isDark = useIsDark(isDarkProp);
248
- const theme = isDark ? colors.dark : colors.light;
249
- const { View, Text } = primitives();
250
-
251
- const percent =
252
- task.progress == null ? null : Math.round(Math.min(1, Math.max(0, task.progress)) * 100);
253
- const status = task.status ?? "running";
254
- const fillColor =
255
- status === "failed" ? theme.destructive : status === "done" ? "#34c759" : theme.fill;
256
-
257
- return (
258
- <View
259
- accessibilityRole="progressbar"
260
- accessibilityLabel={task.label ?? "Task progress"}
261
- // Without the value, a screen reader only reads the label and never says
262
- // how far along the task is.
263
- accessibilityValue={percent == null ? undefined : { min: 0, max: 100, now: percent }}
264
- accessibilityState={{
265
- disabled: false,
266
- }}
267
- style={style as StyleProp<ViewStyle>}
268
- >
269
- <View
270
- style={{ flexDirection: "row", justifyContent: "space-between", marginBottom: 6 }}
271
- >
272
- <Text style={{ fontSize: 12, fontWeight: "500", color: theme.foreground }}>
273
- {task.label ?? "Task"}
274
- </Text>
275
- <Text style={{ fontSize: 11, color: theme.muted }}>
276
- {percent == null ? "…" : `${percent}%`}
277
- </Text>
278
- </View>
279
-
280
- <View
281
- style={{
282
- height: 6,
283
- borderRadius: 3,
284
- backgroundColor: isDark ? "rgba(235,235,245,0.15)" : "rgba(0,0,0,0.08)",
285
- overflow: "hidden",
286
- }}
287
- >
288
- <View
289
- style={{
290
- // An indeterminate task fills partially rather than pretending 0%.
291
- width: percent == null ? "35%" : `${percent}%`,
292
- height: "100%",
293
- borderRadius: 3,
294
- backgroundColor: fillColor,
295
- opacity: percent == null ? 0.6 : 1,
296
- }}
297
- />
298
- </View>
299
-
300
- {task.detail && (
301
- <Text style={{ fontSize: 11, color: theme.muted, marginTop: 6 }}>{task.detail}</Text>
302
- )}
303
- </View>
304
- );
305
- }
306
-
307
- export interface NativeSoundwaveProps {
308
- levels?: number[];
309
- bars?: number;
310
- active?: boolean;
311
- height?: number;
312
- color?: string;
313
- isDark?: boolean;
314
- style?: any;
315
- label?: string;
316
- }
317
-
318
- /**
319
- * A waveform driven by real amplitude.
320
- *
321
- * Bars follow `levels` when supplied, so it can show live microphone input.
322
- * Without levels it rests at a low, static profile instead of animating:
323
- * continuous motion with no audio behind it would be decorative noise.
324
- */
325
- export function NativeSoundwave({
326
- levels,
327
- bars = 28,
328
- active = true,
329
- height = 40,
330
- color,
331
- isDark: isDarkProp,
332
- style,
333
- label = "Audio level",
334
- }: NativeSoundwaveProps) {
335
- const isDark = useIsDark(isDarkProp);
336
- const theme = isDark ? colors.dark : colors.light;
337
- const { View } = primitives();
338
-
339
- const count = levels?.length || bars;
340
- const tint = color ?? theme.foreground;
341
-
342
- return (
343
- <View
344
- accessibilityRole="image"
345
- accessibilityLabel={label}
346
- style={{ flexDirection: "row", alignItems: "center", gap: 2, height, ...style }}
347
- >
348
- {Array.from({ length: count }, (_, i) => {
349
- const level = levels ? levels[i] ?? 0 : 0;
350
- // Idle bars taper at the edges so the shape still reads as a wave.
351
- const idle = 0.12 + Math.sin((i / count) * Math.PI) * 0.1;
352
- const scale = Math.max(0.06, Math.min(1, active && levels ? level : idle));
353
- return (
354
- <View
355
- key={i}
356
- style={{
357
- width: 3,
358
- height: height * scale,
359
- borderRadius: 2,
360
- backgroundColor: tint,
361
- opacity: active ? 0.85 : 0.35,
362
- }}
363
- />
364
- );
365
- })}
366
- </View>
367
- );
368
- }
369
-
370
- export interface NativeThinkingOrbProps {
371
- label?: string;
372
- size?: number;
373
- paused?: boolean;
374
- isDark?: boolean;
375
- style?: any;
376
- }
377
-
378
- /**
379
- * A pulsing indicator shown while a model is working.
380
- *
381
- * Purely decorative, so it is hidden from screen readers and the label is
382
- * exposed as text instead of relying on the motion being perceived.
383
- */
384
- export function NativeThinkingOrb({
385
- label = "Thinking",
386
- size = 22,
387
- paused = false,
388
- isDark: isDarkProp,
389
- style,
390
- }: NativeThinkingOrbProps) {
391
- const isDark = useIsDark(isDarkProp);
392
- const theme = isDark ? colors.dark : colors.light;
393
- const { View, Text } = primitives();
394
- const reducedMotion = useReducedMotion();
395
- const [tick, setTick] = useState(0);
396
-
397
- // Reduce Motion: the orb stops pulsing and holds a steady size. The label is
398
- // what carries the meaning, so nothing is lost by not moving.
399
- const still = paused || reducedMotion;
400
-
401
- useEffect(() => {
402
- if (still) return;
403
- const timer = setInterval(() => setTick((value) => value + 1), 700);
404
- return () => clearInterval(timer);
405
- }, [still]);
406
-
407
- const scale = still ? 1 : [1, 1.12, 1][tick % 3]!;
408
-
409
- return (
410
- <View
411
- accessibilityRole="text"
412
- accessibilityLabel={label}
413
- style={{ flexDirection: "row", alignItems: "center", gap: 8, ...style }}
414
- >
415
- <View
416
- style={{
417
- width: size,
418
- height: size,
419
- borderRadius: size / 2,
420
- backgroundColor: theme.fill,
421
- opacity: paused ? 0.5 : 0.85,
422
- transform: [{ scale }],
423
- }}
424
- />
425
- <Text style={{ fontSize: 12, color: theme.muted }}>{label}</Text>
426
- </View>
427
- );
428
- }
429
-
430
- export interface NativePanelNavItem {
431
- id: string;
432
- label: string;
433
- count?: number;
434
- }
435
-
436
- export interface NativePanelsideProps {
437
- items: NativePanelNavItem[];
438
- value?: string;
439
- onValueChange?: (id: string) => void;
440
- isDark?: boolean;
441
- style?: any;
442
- title?: string;
443
- }
444
-
445
- /**
446
- * A rail for an AI workspace: conversations, saved prompts or tasks.
447
- *
448
- * Selection is a press rather than navigation because the panel's content is
449
- * client state; the caller decides what a selection means.
450
- */
451
- export function NativePanelside({
452
- items,
453
- value,
454
- onValueChange,
455
- isDark: isDarkProp,
456
- style,
457
- title,
458
- }: NativePanelsideProps) {
459
- const isDark = useIsDark(isDarkProp);
460
- const theme = isDark ? colors.dark : colors.light;
461
- const { View, Text, Pressable } = primitives();
462
-
463
- return (
464
- <View style={style}>
465
- {title && (
466
- <Text style={{ fontSize: 11, fontWeight: "600", color: theme.muted, marginBottom: 6 }}>
467
- {title}
468
- </Text>
469
- )}
470
-
471
- {items.map((item) => {
472
- const isActive = item.id === value;
473
- return (
474
- <Pressable
475
- key={item.id}
476
- accessibilityRole="button"
477
- accessibilityState={{ selected: isActive }}
478
- accessibilityLabel={item.label}
479
- onPress={() => onValueChange?.(item.id)}
480
- style={{
481
- flexDirection: "row",
482
- alignItems: "center",
483
- justifyContent: "space-between",
484
- paddingVertical: 9,
485
- paddingHorizontal: 11,
486
- borderRadius: radii.md,
487
- backgroundColor: isActive ? theme.glassActive : "transparent",
488
- marginBottom: 2,
489
- }}
490
- >
491
- <Text
492
- style={{
493
- fontSize: 13,
494
- color: isActive ? theme.foreground : theme.muted,
495
- fontWeight: isActive ? "600" : "400",
496
- }}
497
- >
498
- {item.label}
499
- </Text>
500
- {item.count != null && (
501
- <Text style={{ fontSize: 10, color: theme.muted }}>{item.count}</Text>
502
- )}
503
- </Pressable>
504
- );
505
- })}
506
- </View>
507
- );
508
- }
509
-
510
- export interface NativeAIInputProps {
511
- /** Controlled text. Omit it and the composer keeps its own. */
512
- value?: string;
513
- /** Starting text for uncontrolled use. */
514
- defaultValue?: string;
515
- onChangeText?: (text: string) => void;
516
- onSubmit?: () => void;
517
- placeholder?: string;
518
- disabled?: boolean;
519
- /** Shown as a spinner-free label while a response is pending. */
520
- busy?: boolean;
521
- sendLabel?: string;
522
- isDark?: boolean;
523
- style?: any;
524
- footer?: ReactNode;
525
- }
526
-
527
- /**
528
- * The composer for an AI conversation.
529
- *
530
- * Send stays disabled until there is non-whitespace to send, which is the rule
531
- * that prevents empty submissions rather than a validation message afterwards.
532
- */
533
- export function NativeAIInput({
534
- value: valueProp,
535
- defaultValue,
536
- onChangeText,
537
- onSubmit,
538
- placeholder = "Ask anything",
539
- disabled = false,
540
- busy = false,
541
- sendLabel = "Send",
542
- isDark: isDarkProp,
543
- style,
544
- footer,
545
- }: NativeAIInputProps) {
546
- const isDark = useIsDark(isDarkProp);
547
- const theme = isDark ? colors.dark : colors.light;
548
- const { View, Text, TextInput, Pressable } = primitives();
549
-
550
- // Uncontrolled support: the composer owns its text when no `value` is given,
551
- // which is what makes typed text appear in plain uncontrolled use.
552
- const [internalText, setInternalText] = useState(defaultValue ?? "");
553
- const value = valueProp !== undefined ? valueProp : internalText;
554
- const handleChangeText = (next: string) => {
555
- if (valueProp === undefined) setInternalText(next);
556
- onChangeText?.(next);
557
- };
558
-
559
- const canSend = !disabled && !busy && value.trim().length > 0;
560
- // The themed placeholder is drawn as a Text, matching Input: the OS default
561
- // placeholder colour ignores the theme.
562
- const showPlaceholder = !value && Boolean(placeholder);
563
-
564
- return (
565
- <View style={style as StyleProp<ViewStyle>}>
566
- <View
567
- style={{
568
- flexDirection: "row",
569
- alignItems: "flex-end",
570
- gap: 8,
571
- padding: 8,
572
- borderRadius: radii.lg,
573
- borderWidth: 1,
574
- borderColor: theme.edge,
575
- backgroundColor: theme.glass,
576
- opacity: disabled ? 0.5 : 1,
577
- }}
578
- >
579
- <View style={{ flex: 1, justifyContent: "center" }}>
580
- {showPlaceholder && (
581
- <Text
582
- pointerEvents="none"
583
- numberOfLines={1}
584
- style={{
585
- position: "absolute",
586
- left: 6,
587
- fontSize: 14,
588
- color: theme.muted,
589
- }}
590
- >
591
- {placeholder}
592
- </Text>
593
- )}
594
-
595
- <TextInput
596
- value={value}
597
- onChangeText={handleChangeText}
598
- editable={!disabled}
599
- multiline
600
- numberOfLines={3}
601
- accessibilityLabel={placeholder}
602
- accessibilityState={{ disabled }}
603
- style={{
604
- minHeight: 34,
605
- maxHeight: 120,
606
- paddingHorizontal: 6,
607
- paddingVertical: 7,
608
- fontSize: 14,
609
- color: theme.foreground,
610
- }}
611
- />
612
- </View>
613
-
614
- <Pressable
615
- accessibilityRole="button"
616
- accessibilityLabel={sendLabel}
617
- accessibilityState={{ disabled: !canSend }}
618
- disabled={!canSend}
619
- onPress={() => canSend && onSubmit?.()}
620
- style={{
621
- paddingVertical: 8,
622
- paddingHorizontal: 14,
623
- borderRadius: radii.pill,
624
- backgroundColor: canSend ? theme.fill : theme.edge,
625
- }}
626
- >
627
- <Text style={{ fontSize: 13, fontWeight: "600", color: canSend ? "#fff" : theme.muted }}>
628
- {busy ? "…" : sendLabel}
629
- </Text>
630
- </Pressable>
631
- </View>
632
-
633
- {footer}
634
- </View>
635
- );
636
- }
637
-
638
- export interface NativeGeneratedImage {
639
- url: string;
640
- alt: string;
641
- width?: number;
642
- height?: number;
643
- /** Shown under the image while generation is still running. */
644
- progress?: number;
645
- }
646
-
647
- export interface NativeImageGenerationProps {
648
- image?: NativeGeneratedImage;
649
- prompt?: string;
650
- status?: "queued" | "generating" | "done" | "failed";
651
- isDark?: boolean;
652
- style?: any;
653
- }
654
-
655
- /**
656
- * A generated image with its prompt and state.
657
- *
658
- * While generating, a placeholder with the same aspect ratio holds the space so
659
- * the layout does not jump when the image arrives.
660
- */
661
- export function NativeImageGeneration({
662
- image,
663
- prompt,
664
- status = "queued",
665
- isDark: isDarkProp,
666
- style,
667
- }: NativeImageGenerationProps) {
668
- const isDark = useIsDark(isDarkProp);
669
- const theme = isDark ? colors.dark : colors.light;
670
- const { View, Text, Image } = primitives();
671
-
672
- const width = image?.width ?? 320;
673
- const height = image?.height ?? 200;
674
- const showImage = image && status === "done";
675
-
676
- return (
677
- <View style={style}>
678
- <View
679
- style={{
680
- width: "100%",
681
- aspectRatio: width / height,
682
- borderRadius: radii.md,
683
- overflow: "hidden",
684
- backgroundColor: isDark ? "rgba(235,235,245,0.08)" : "rgba(0,0,0,0.05)",
685
- alignItems: "center",
686
- justifyContent: "center",
687
- }}
688
- >
689
- {showImage ? (
690
- <Image
691
- source={{ uri: image.url }}
692
- accessibilityLabel={image.alt}
693
- style={{ width: "100%", height: "100%" }}
694
- />
695
- ) : (
696
- <Text style={{ fontSize: 12, color: theme.muted }}>
697
- {status === "failed" ? "Generation failed" : "Generating…"}
698
- </Text>
699
- )}
700
- </View>
701
-
702
- {prompt && (
703
- <Text style={{ fontSize: 11, color: theme.muted, marginTop: 6 }}>{prompt}</Text>
704
- )}
705
- </View>
706
- );
707
- }