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
@@ -0,0 +1,105 @@
1
+ // The selected lens: one raised surface, without a second glass material.
2
+ //
3
+ // Every selected thing in the fallback — a list row, a menu option, a chosen
4
+ // weekday, the tab bar's indicator — is the web's "lens": the selected tint,
5
+ // lifted by a shadow, with the same painted rim as the surfaces around it.
6
+ //
7
+ // It cannot be a `Glass`. Glass inside a glass panel is glass-on-glass, which
8
+ // the material rules forbid, and the surfaces these sit in are already glass.
9
+ // So the lens is painted directly: tint, shadow, rim. Same look, no stacking.
10
+
11
+ import type { ReactNode } from "react";
12
+ import type { StyleProp, ViewStyle } from "react-native";
13
+
14
+ import { colors, material, radii } from "./tokens";
15
+ import { primitives } from "./primitives";
16
+ import { GlassRim } from "./rim";
17
+
18
+ const fill = { position: "absolute", top: 0, left: 0, right: 0, bottom: 0 } as const;
19
+
20
+ /**
21
+ * How far a lens sits above its row.
22
+ *
23
+ * Shallower than a panel's shadow: a lens is inside a surface that already
24
+ * floats, so it needs contact, not altitude.
25
+ */
26
+ export function lensShadow(isDark?: boolean): ViewStyle {
27
+ return {
28
+ shadowColor: material.shadowColor,
29
+ shadowOpacity: isDark ? 0 : 0.1,
30
+ shadowRadius: 8,
31
+ shadowOffset: { width: 0, height: 2 },
32
+ } as ViewStyle;
33
+ }
34
+
35
+ /**
36
+ * The rim of a lens, on its own.
37
+ *
38
+ * For indicators that are already animated views and cannot become a
39
+ * `SelectedLens`: they keep their own transform, and this paints the light on
40
+ * top of whatever tint they already have.
41
+ */
42
+ export function LensRim({ radius, isDark }: { radius: number; isDark?: boolean }) {
43
+ const { View } = primitives();
44
+ const rim = (isDark ? material.rim.dark : material.rim.light) * 0.66;
45
+ return (
46
+ <View style={{ ...fill, overflow: "hidden", borderRadius: radius }} pointerEvents="none">
47
+ <GlassRim radius={radius} rim={rim} highlight={material.highlight * 0.7} />
48
+ </View>
49
+ );
50
+ }
51
+
52
+ export interface SelectedLensProps {
53
+ /** The lens shape. A circle is simply a radius of half the side. */
54
+ radius: number;
55
+ isDark?: boolean;
56
+ style?: StyleProp<ViewStyle>;
57
+ children?: ReactNode;
58
+ testID?: string;
59
+ }
60
+
61
+ /**
62
+ * A selected state, drawn as the web's lens.
63
+ *
64
+ * Rendered as an absolutely positioned overlay so it never changes the layout
65
+ * of the row it marks: parents keep their padding and press handling, and the
66
+ * content paints above it by sibling order.
67
+ */
68
+ export function SelectedLens({ radius, isDark, style, children, testID }: SelectedLensProps) {
69
+ const { View } = primitives();
70
+ const theme = isDark ? colors.dark : colors.light;
71
+
72
+ return (
73
+ <View
74
+ testID={testID}
75
+ pointerEvents="none"
76
+ style={[
77
+ {
78
+ borderRadius: radius,
79
+ backgroundColor: theme.glassActive,
80
+ ...lensShadow(isDark),
81
+ },
82
+ style as ViewStyle,
83
+ ]}
84
+ >
85
+ {/* A tighter rim than a panel's: small surfaces catch less light. */}
86
+ <LensRim radius={radius} isDark={isDark} />
87
+ {children}
88
+ </View>
89
+ );
90
+ }
91
+
92
+ /** The lens overlay for a row: inset from the panel's edges, full width inside. */
93
+ export function rowLensStyle(radius: number, inset = 6): ViewStyle {
94
+ return {
95
+ position: "absolute",
96
+ top: 2,
97
+ bottom: 2,
98
+ left: inset,
99
+ right: inset,
100
+ borderRadius: radius,
101
+ };
102
+ }
103
+
104
+ /** A pill lens filling its own box, for indicators pinned to a control. */
105
+ export const lensFill = { ...fill, borderRadius: radii.pill } as const;
@@ -0,0 +1,92 @@
1
+ // The fallback's material recipe — the web engine's surface profiles, in
2
+ // React Native terms.
3
+ //
4
+ // The web fits a different lens per component family (panel, control, field,
5
+ // overlay, hint, rail). The fallback had a single flat surface for all of
6
+ // them, which is why a dialog and a badge looked identical. This module turns
7
+ // each profile into the numbers the layered fallback needs: how strongly the
8
+ // backdrop is blurred, how bright the rim is, how much light sits inside the
9
+ // top edge, and whether the surface is lifted by a shadow.
10
+ //
11
+ // Nothing here renders. It is a table plus one resolver, so the fallback
12
+ // component stays a layout and the profiles stay reviewable against the web.
13
+
14
+ import { material } from "./tokens";
15
+
16
+ /** The six surfaces the web engine distinguishes. */
17
+ export type SurfaceProfile = "panel" | "control" | "field" | "overlay" | "hint" | "rail";
18
+
19
+ /**
20
+ * The web profile values this mapping is derived from.
21
+ *
22
+ * Kept in the same order and with the same names as the engine's table so the
23
+ * two can be diffed by eye: bend drives the blur strength, depth the inner
24
+ * highlight, and dome the rim brightness (the dome is the part of the lens
25
+ * that catches the light).
26
+ */
27
+ const webProfiles: Record<
28
+ SurfaceProfile,
29
+ { bend: number; depth: number; dome: number }
30
+ > = {
31
+ panel: { bend: 0.45, depth: 0.25, dome: 0.5 },
32
+ control: { bend: 0.55, depth: 0.3, dome: 0.6 },
33
+ field: { bend: 0.35, depth: 0.2, dome: 0.34 },
34
+ overlay: { bend: 0.5, depth: 0.34, dome: 0.66 },
35
+ hint: { bend: 0.28, depth: 0.22, dome: 0.3 },
36
+ rail: { bend: 0.4, depth: 0.22, dome: 0.4 },
37
+ };
38
+
39
+ /** A resolved material for one surface, in the units React Native accepts. */
40
+ export interface ResolvedMaterial {
41
+ /** Backdrop blur intensity on expo-blur's 0–100 scale. */
42
+ blur: number;
43
+ /** Alpha of the rim's brightest (top) stop. */
44
+ rim: number;
45
+ /** Alpha of the highlight inside the top edge. */
46
+ highlight: number;
47
+ /** How far the surface is lifted, from the theme's shadow tokens. */
48
+ shadowOpacity: number;
49
+ shadowRadius: number;
50
+ shadowOffsetY: number;
51
+ /** Android's equivalent of the iOS shadow. */
52
+ elevation: number;
53
+ }
54
+
55
+ /** The reference profile: the panel is the base lens the others scale from. */
56
+ const BASE_BLUR = 24;
57
+ const BASE_DOME = webProfiles.panel.dome;
58
+ const BASE_DEPTH = webProfiles.panel.depth;
59
+
60
+ /**
61
+ * The material for one surface.
62
+ *
63
+ * The `clear` effect is the same stack with a thinner lens — less blur and a
64
+ * fainter rim — which is what the web means by clear. Reduce Transparency is
65
+ * handled before this call: it replaces the whole stack with a solid colour.
66
+ */
67
+ export function materialFor(
68
+ profile: SurfaceProfile = "panel",
69
+ effect: "clear" | "regular" | "none" = "regular",
70
+ isDark = false,
71
+ ): ResolvedMaterial {
72
+ const lens = webProfiles[profile];
73
+ const thin = effect === "clear" ? 0.55 : 1;
74
+ const rimBase = isDark ? material.rim.dark : material.rim.light;
75
+
76
+ return {
77
+ blur: Math.round(BASE_BLUR * (lens.bend / webProfiles.panel.bend) * thin),
78
+ rim: rimBase * (lens.dome / BASE_DOME) * thin,
79
+ highlight: material.highlight * (lens.depth / BASE_DEPTH) * thin,
80
+ // The web drops every surface by 1px; overlays carry their own, deeper
81
+ // shadow from the component's style, which the fallback prefers when set.
82
+ shadowOpacity: isDark ? 0 : material.shadowOpacity.light,
83
+ shadowRadius: 3,
84
+ shadowOffsetY: 1,
85
+ elevation: isDark ? 0 : 1,
86
+ };
87
+ }
88
+
89
+ /** Whether a surface is a shadowed one at all (the hint family sits flat). */
90
+ export function isFlatProfile(profile: SurfaceProfile): boolean {
91
+ return profile === "hint";
92
+ }
@@ -0,0 +1,258 @@
1
+ // The invisible behaviour every Wave 2 component shares.
2
+ //
3
+ // These are the donor's contracts, implemented on React Native's own
4
+ // primitives: a component can be controlled or keep its own state, overlays
5
+ // dismiss on Android's back gesture and on an outside press, and every control
6
+ // exposes the accessibility role the donor gives it (checkbox, radio, tab,
7
+ // dialog, menu). Nothing here styles anything — the Apple dress lives in the
8
+ // component files.
9
+
10
+ import { useCallback, useEffect, useRef, useState } from "react";
11
+ import type { ReactNode } from "react";
12
+ import type { StyleProp, ViewStyle } from "react-native";
13
+
14
+ import { Glass } from "../Glass";
15
+ import { colors, radii } from "./tokens";
16
+ import { primitives } from "./primitives";
17
+ import { useIsDark } from "./motion";
18
+
19
+ /**
20
+ * Controlled-or-uncontrolled state. The donor's model: a `value` prop makes the
21
+ * component controlled, `defaultValue` seeds it, and `onChange` is called either
22
+ * way. Kept in one place so every component behaves identically.
23
+ */
24
+ export function useControllable<T>(
25
+ value: T | undefined,
26
+ defaultValue: T,
27
+ onChange?: (value: T) => void,
28
+ ): [T, (next: T) => void] {
29
+ const [internal, setInternal] = useState(defaultValue);
30
+ const current = value !== undefined ? value : internal;
31
+ const set = useCallback(
32
+ (next: T) => {
33
+ if (value === undefined) setInternal(next);
34
+ onChange?.(next);
35
+ },
36
+ [value, onChange],
37
+ );
38
+ return [current, set];
39
+ }
40
+
41
+ /**
42
+ * Registers Android's hardware back while an overlay is open, so back closes the
43
+ * layer and not the screen behind it.
44
+ */
45
+ export function useBackDismiss(open: boolean, dismiss: () => void) {
46
+ useEffect(() => {
47
+ if (!open) return;
48
+ const BackHandler = primitives().getBackHandler();
49
+ if (!BackHandler?.addEventListener) return;
50
+ const sub = BackHandler.addEventListener("hardwareBackPress", () => {
51
+ dismiss();
52
+ return true;
53
+ });
54
+ return () => sub?.remove?.();
55
+ }, [open, dismiss]);
56
+ }
57
+
58
+ export interface AnchorRect {
59
+ x: number;
60
+ y: number;
61
+ width: number;
62
+ height: number;
63
+ }
64
+
65
+ /** Reads a view's rectangle in window coordinates, when the runtime can. */
66
+ export function measureAnchor(node: any): Promise<AnchorRect | null> {
67
+ return new Promise((resolve) => {
68
+ if (!node || typeof node.measureInWindow !== "function") {
69
+ resolve(null);
70
+ return;
71
+ }
72
+ try {
73
+ node.measureInWindow((x: number, y: number, width: number, height: number) => {
74
+ resolve({ x, y, width, height });
75
+ });
76
+ } catch {
77
+ resolve(null);
78
+ }
79
+ });
80
+ }
81
+
82
+ /**
83
+ * Places a panel beside its trigger. Flips above when there is no room below,
84
+ * and clamps to the viewport otherwise — the donor's collision handling, kept
85
+ * deliberately small.
86
+ */
87
+ export function placePanel(
88
+ trigger: AnchorRect,
89
+ panel: { width: number; height: number },
90
+ viewport: { width: number; height: number },
91
+ gap = 6,
92
+ ): { left: number; top: number; flipped: boolean } {
93
+ const below = trigger.y + trigger.height + gap;
94
+ const above = trigger.y - panel.height - gap;
95
+ const fitsBelow = below + panel.height <= viewport.height;
96
+ const flipped = !fitsBelow && above >= 0;
97
+ const top = Math.max(8, Math.min(flipped ? above : below, viewport.height - panel.height - 8));
98
+ const left = Math.max(8, Math.min(trigger.x, viewport.width - panel.width - 8));
99
+ return { left, top, flipped };
100
+ }
101
+
102
+ /**
103
+ * A full-screen modal layer with a dimmed backdrop and a glass panel. Used by
104
+ * Dialog, Alert, AlertDialog, Popover, DropdownMenu, ContextMenu, Select and
105
+ * Tooltip, so dismissal, back handling and the surface are one implementation.
106
+ */
107
+ export function OverlayPanel({
108
+ open,
109
+ onClose,
110
+ dismissOnBackdropPress = true,
111
+ anchor,
112
+ width,
113
+ panelStyle,
114
+ children,
115
+ testID,
116
+ isDark: isDarkProp,
117
+ accessibilityLabel,
118
+ role = "menu",
119
+ }: {
120
+ open: boolean;
121
+ onClose: () => void;
122
+ dismissOnBackdropPress?: boolean;
123
+ anchor?: AnchorRect | null;
124
+ width?: number;
125
+ panelStyle?: StyleProp<ViewStyle>;
126
+ children: ReactNode;
127
+ testID?: string;
128
+ isDark?: boolean;
129
+ accessibilityLabel?: string;
130
+ role?: string;
131
+ }) {
132
+ const isDark = useIsDark(isDarkProp);
133
+ const theme = isDark ? colors.dark : colors.light;
134
+ const { View, Pressable, Modal, useWindowDimensions } = primitives();
135
+ const { width: screenWidth, height: screenHeight } = useWindowDimensions();
136
+ useBackDismiss(open, onClose);
137
+
138
+ if (!open) return null;
139
+
140
+ const placed = anchor ? placePanel(anchor, { width: width ?? 240, height: 0 }, { width: screenWidth, height: screenHeight }) : null;
141
+
142
+ return (
143
+ <Modal visible transparent animationType="fade" onRequestClose={onClose}>
144
+ <View style={{ flex: 1, backgroundColor: theme.scrim }}>
145
+ <Pressable
146
+ accessibilityRole="button"
147
+ accessibilityLabel={dismissOnBackdropPress ? "Close" : undefined}
148
+ onPress={dismissOnBackdropPress ? onClose : undefined}
149
+ style={{ position: "absolute", top: 0, left: 0, right: 0, bottom: 0 }}
150
+ />
151
+ <View
152
+ pointerEvents="box-none"
153
+ style={placed ? { position: "absolute", left: placed.left, top: placed.top } : { flex: 1, alignItems: "center", justifyContent: "center", padding: 24 }}
154
+ >
155
+ <Pressable accessibilityRole="none" onPress={() => {}}>
156
+ <Glass
157
+ effect="regular"
158
+ surface="overlay"
159
+ isDark={isDark}
160
+ testID={testID}
161
+ accessibilityLabel={accessibilityLabel}
162
+ accessibilityRole={role as any}
163
+ style={[
164
+ {
165
+ width: placed ? width ?? 240 : undefined,
166
+ maxWidth: screenWidth - 32,
167
+ borderRadius: radii.lg,
168
+ backgroundColor: theme.surface,
169
+ paddingVertical: 6,
170
+ },
171
+ panelStyle,
172
+ ]}
173
+ >
174
+ {children}
175
+ </Glass>
176
+ </Pressable>
177
+ </View>
178
+ </View>
179
+ </Modal>
180
+ );
181
+ }
182
+
183
+ /** One row inside an overlay panel — the donor's menu/option item. */
184
+ export function PanelItem({
185
+ label,
186
+ onPress,
187
+ icon,
188
+ destructive = false,
189
+ selected = false,
190
+ disabled = false,
191
+ role = "button",
192
+ style,
193
+ testID,
194
+ isDark: isDarkProp,
195
+ }: {
196
+ label: string;
197
+ onPress: () => void;
198
+ icon?: ReactNode;
199
+ destructive?: boolean;
200
+ selected?: boolean;
201
+ disabled?: boolean;
202
+ role?: string;
203
+ style?: StyleProp<ViewStyle>;
204
+ testID?: string;
205
+ isDark?: boolean;
206
+ }) {
207
+ const isDark = useIsDark(isDarkProp);
208
+ const theme = isDark ? colors.dark : colors.light;
209
+ const { View, Pressable, Text: RNText } = primitives();
210
+ return (
211
+ <Pressable
212
+ testID={testID}
213
+ accessibilityRole={role as any}
214
+ accessibilityLabel={label}
215
+ accessibilityState={{ disabled, selected }}
216
+ disabled={disabled}
217
+ onPress={onPress}
218
+ style={[
219
+ {
220
+ flexDirection: "row",
221
+ alignItems: "center",
222
+ gap: 10,
223
+ minHeight: 40,
224
+ paddingHorizontal: 14,
225
+ paddingVertical: 8,
226
+ opacity: disabled ? 0.38 : 1,
227
+ },
228
+ style,
229
+ ]}
230
+ >
231
+ {icon ? <View>{icon}</View> : null}
232
+ <RNText
233
+ numberOfLines={1}
234
+ style={{
235
+ flex: 1,
236
+ fontSize: 15,
237
+ color: destructive ? theme.destructive : theme.foreground,
238
+ fontWeight: selected ? "600" : "400",
239
+ }}
240
+ >
241
+ {label}
242
+ </RNText>
243
+ {selected ? <RNText style={{ fontSize: 15, color: theme.fill }}>✓</RNText> : null}
244
+ </Pressable>
245
+ );
246
+ }
247
+
248
+ /** A positioned trigger that reports its window rectangle when it is pressed. */
249
+ export function useTriggerAnchor() {
250
+ const ref = useRef<any>(null);
251
+ const [anchor, setAnchor] = useState<AnchorRect | null>(null);
252
+ const capture = useCallback(async () => {
253
+ const rect = await measureAnchor(ref.current);
254
+ if (rect) setAnchor(rect);
255
+ return rect;
256
+ }, []);
257
+ return { ref, anchor, capture };
258
+ }
@@ -31,6 +31,8 @@ export interface RNPrimitives {
31
31
  /** Gradient and clipping nodes, for the colour picker's hue track. */
32
32
  Defs: any;
33
33
  LinearGradient: any;
34
+ /** The radial gradient the press glow is painted with. */
35
+ RadialGradient: any;
34
36
  Stop: any;
35
37
  ClipPath: any;
36
38
  SvgText: any;
@@ -64,6 +66,12 @@ export interface RNPrimitives {
64
66
  * it can resolve them.
65
67
  */
66
68
  useWindowDimensions: () => { width: number; height: number };
69
+ /**
70
+ * React Native's safe-area insets, or a zero reader off-device. Bottom bars
71
+ * (the TabBar) float the glass above the system inset — the Android nav bar or
72
+ * the iOS home indicator — instead of letting it sink under.
73
+ */
74
+ useSafeAreaInsets: () => { top: number; bottom: number; left: number; right: number };
67
75
  }
68
76
 
69
77
  /**
@@ -165,6 +173,15 @@ function resolve(): RNPrimitives {
165
173
  slider: "slider",
166
174
  adjustable: "slider",
167
175
  heading: "heading",
176
+ option: "option",
177
+ listbox: "listbox",
178
+ menu: "menu",
179
+ menuitem: "menuitem",
180
+ dialog: "dialog",
181
+ alertdialog: "alertdialog",
182
+ group: "group",
183
+ toolbar: "toolbar",
184
+ separator: "separator",
168
185
  };
169
186
  // "none" means presentational: emit no role rather than a misleading one.
170
187
  if (accessibilityRole && accessibilityRole !== "none") {
@@ -296,6 +313,7 @@ function resolve(): RNPrimitives {
296
313
  Polygon: svg?.Polygon ?? fallback("polygon"),
297
314
  Defs: svg?.Defs ?? fallback("defs"),
298
315
  LinearGradient: svg?.LinearGradient ?? fallback("linearGradient"),
316
+ RadialGradient: svg?.RadialGradient ?? fallback("radialGradient"),
299
317
  Stop: svg?.Stop ?? fallback("stop"),
300
318
  ClipPath: svg?.ClipPath ?? fallback("clipPath"),
301
319
  // TextInput is not an SVG primitive, but resolving it here keeps every
@@ -328,6 +346,14 @@ function resolve(): RNPrimitives {
328
346
  const view: any = typeof globalThis !== "undefined" ? (globalThis as any).window : undefined;
329
347
  return { width: view?.innerWidth ?? 390, height: view?.innerHeight ?? 800 };
330
348
  }),
349
+ useSafeAreaInsets:
350
+ rn?.useSafeAreaInsets ??
351
+ (() => ({
352
+ top: 0,
353
+ bottom: 0,
354
+ left: 0,
355
+ right: 0,
356
+ })),
331
357
  };
332
358
  }
333
359
 
@@ -0,0 +1,79 @@
1
+ // The painted rim: light caught on the curved edge of a glass surface.
2
+ //
3
+ // This is the layer that makes a rounded corner *read* as rounded. The web
4
+ // engine paints a rim gradient into every glass element (brightest along the
5
+ // top edge, fading down the sides, nearly gone at the bottom), plus a soft
6
+ // highlight just inside the top. The fallback only had a uniform 8% edge line,
7
+ // which is why the owner described the corners as "not fully curved".
8
+ //
9
+ // Drawn in SVG because that is what the package already uses for its charts
10
+ // and share the same resolver: no new native dependency, and it works
11
+ // identically on iOS and Android.
12
+
13
+ import { useId } from "react";
14
+
15
+ import { primitives } from "./primitives";
16
+ import { material } from "./tokens";
17
+
18
+ const fill = { position: "absolute", top: 0, left: 0, right: 0, bottom: 0 } as const;
19
+
20
+ export interface GlassRimProps {
21
+ /** The surface's corner radius, so the rim follows the shape. */
22
+ radius: number;
23
+ /** Alpha of the brightest (top) part of the rim. */
24
+ rim: number;
25
+ /** Alpha of the highlight inside the top edge. */
26
+ highlight: number;
27
+ }
28
+
29
+ /**
30
+ * The rim light and top highlight of one surface.
31
+ *
32
+ * Both are stacked stops of a vertical gradient in the same colour: the eye
33
+ * reads the brightest edge as a lit curve and the falloff as the curve turning
34
+ * away from the light.
35
+ */
36
+ export function GlassRim({ radius, rim, highlight }: GlassRimProps) {
37
+ const { Svg, Defs, Rect, LinearGradient, Stop } = primitives();
38
+ const key = useId().replace(/[^a-zA-Z0-9_-]/g, "");
39
+ const rimId = `rim-${key}`;
40
+ const highlightId = `top-${key}`;
41
+ // SVG clamps rx/ry to half the side, so a pill radius simply becomes a pill.
42
+ const rx = Math.max(0, radius - 0.5);
43
+
44
+ return (
45
+ <Svg width="100%" height="100%" style={fill} pointerEvents="none">
46
+ <Defs>
47
+ <LinearGradient id={rimId} x1="0" y1="0" x2="0" y2="1">
48
+ <Stop offset="0" stopColor={material.rimColor} stopOpacity={rim} />
49
+ <Stop offset="0.55" stopColor={material.rimColor} stopOpacity={rim * 0.35} />
50
+ <Stop offset="1" stopColor={material.rimColor} stopOpacity={rim * 0.08} />
51
+ </LinearGradient>
52
+ <LinearGradient id={highlightId} x1="0" y1="0" x2="0" y2="1">
53
+ <Stop offset="0" stopColor={material.rimColor} stopOpacity={highlight} />
54
+ <Stop offset="1" stopColor={material.rimColor} stopOpacity={0} />
55
+ </LinearGradient>
56
+ </Defs>
57
+ <Rect
58
+ x={0.5}
59
+ y={0.5}
60
+ width="99%"
61
+ height="99%"
62
+ rx={rx}
63
+ ry={rx}
64
+ fill="none"
65
+ stroke={`url(#${rimId})`}
66
+ strokeWidth={1}
67
+ />
68
+ <Rect
69
+ x={1}
70
+ y={1}
71
+ width="98%"
72
+ height="40%"
73
+ rx={Math.max(0, rx - 1)}
74
+ ry={Math.max(0, rx - 1)}
75
+ fill={`url(#${highlightId})`}
76
+ />
77
+ </Svg>
78
+ );
79
+ }
@@ -5,6 +5,7 @@ export const radii = {
5
5
  md: tokenRadii.md.number,
6
6
  lg: tokenRadii.lg.number,
7
7
  xl: tokenRadii.xl.number,
8
+ stack: tokenRadii.stack.number,
8
9
  pill: tokenRadii.pill.number,
9
10
  };
10
11
 
@@ -71,8 +72,16 @@ export const colors = {
71
72
  muted: "#3C3C4399",
72
73
  glass: "rgba(255, 255, 255, 0.6)",
73
74
  glassActive: "rgba(236, 236, 240, 0.85)",
75
+ /**
76
+ * The near-solid surface the web uses where legibility beats translucency:
77
+ * menus and toggle groups. A glass surface underneath text that must be
78
+ * read at a glance is the one place the web deliberately goes opaque-ish.
79
+ */
80
+ surface: "rgba(255, 255, 255, 0.86)",
74
81
  edge: "rgba(0, 0, 0, 0.08)",
75
- separator: "rgba(60, 60, 67, 0.18)",
82
+ // The agreed separator value: the web CSS one (0.15 / 0.16 dark), so the
83
+ // three files that carried three different light values now agree.
84
+ separator: "rgba(60, 60, 67, 0.15)",
76
85
  fill: "#0088FF",
77
86
  destructive: "#FF3B30",
78
87
  on: "#34C759",
@@ -105,6 +114,7 @@ export const colors = {
105
114
  muted: "#EBEBF599",
106
115
  glass: "rgba(40, 40, 40, 0.62)",
107
116
  glassActive: "rgba(70, 70, 70, 0.62)",
117
+ surface: "rgba(40, 40, 40, 0.86)",
108
118
  edge: "rgba(255, 255, 255, 0.08)",
109
119
  separator: "rgba(235, 235, 245, 0.16)",
110
120
  fill: "#0091FF",
@@ -127,6 +137,29 @@ export const colors = {
127
137
  /** Keeps the shared token file honest if a colour is added there first. */
128
138
  export type ThemeColors = typeof colors.light;
129
139
 
140
+ /**
141
+ * The values the fallback's material layers are built from.
142
+ *
143
+ * These are the web engine's numbers, not new inventions: the rim shine is the
144
+ * web's `--gl-rim` brightness (0.30 light / 0.13 dark), the top highlight and
145
+ * press glow are the web overlay alphas, and the drop shadow is the web's
146
+ * `0 1px 3px` black 0.06. They live here, next to the colours, so no component
147
+ * carries a material literal of its own.
148
+ */
149
+ export const material = {
150
+ /** Maximum alpha of the painted rim light, per theme (web: shine). */
151
+ rim: { light: 0.3, dark: 0.13 },
152
+ /** Alpha of the soft highlight drawn inside the top edge. */
153
+ highlight: 0.1,
154
+ /** Alpha of the radial glow that fades in while a surface is held. */
155
+ glow: 0.035,
156
+ /** Shadow colour; the web drops surfaces by 1px with 6% black in light. */
157
+ shadowColor: "#000000",
158
+ shadowOpacity: { light: 0.06, dark: 0 },
159
+ /** The colour the rim light and the top highlight are painted in. */
160
+ rimColor: "#FFFFFF",
161
+ };
162
+
130
163
  /** The semantic tone of a feedback component (Banner, Toast). */
131
164
  export type Tone = "info" | "success" | "warning" | "error";
132
165