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,249 @@
1
+ package expo.modules.liquidglass.glass
2
+
3
+ import android.graphics.BlendMode
4
+ import android.graphics.RenderEffect
5
+ import android.graphics.RuntimeShader
6
+ import android.graphics.Shader
7
+ import android.os.Build
8
+ import android.util.Log
9
+ import androidx.annotation.RequiresApi
10
+ import expo.modules.liquidglass.LOG_TAG
11
+ import kotlin.math.ceil
12
+ import kotlin.math.ln
13
+ import kotlin.math.max
14
+ import kotlin.math.min
15
+ import kotlin.math.pow
16
+
17
+ /**
18
+ * The blur pyramid behind `metal.progressiveBlur`, plus the edge-extension pass every blur stage
19
+ * runs over.
20
+ *
21
+ * A blur whose radius varies per pixel has no cheap exact form. The first cut here was a separable
22
+ * variable-radius Gaussian in AGSL — 8 taps per side with a per-pixel jitter, the Metal renderer's
23
+ * architecture with a ramped radius. Point-sampling a sharp backdrop at strides up to 14 px aliases
24
+ * against text no matter how the comb is dithered, and the vertical pass then smears the horizontal
25
+ * pass's noise into columns: measured on an API 37 emulator and an Adreno 610 as woven vertical
26
+ * streaks through every fully blurred row. Combs dense enough to fix that cost more per frame than
27
+ * a mid-range GPU can pay under a scrolling list.
28
+ *
29
+ * So: a pyramid. One hwui blur — Skia's own, which downsamples internally and is therefore smooth
30
+ * and nearly free at large sigma — per doubling of radius from ~4.5 px up to the ramp's maximum,
31
+ * cross-faded per pixel by the ramp. Level k contributes only while the local radius lies between
32
+ * level k-1's radius and its own, so each pixel is a linear mix of the two levels that bracket its
33
+ * radius: unimodal, no comb, and the sharp end is the untouched original.
34
+ *
35
+ * RenderEffect offers exactly one way to run branches in parallel, `createBlendModeEffect`, and
36
+ * the stack is built from it: SRC_OVER folds, innermost the identity (the original), each level
37
+ * above it a `blur -> weight` chain whose weight shader scales the blurred sample — premultiplied
38
+ * colour and alpha alike — by its ramp weight w. SRC_OVER of that over the fold below is exactly
39
+ * `w * level + (1 - w) * below`, and with `w = clamp((r - r_below) / (r_k - r_below), 0, 1)` every
40
+ * level below the bracketing pair is fully on and every level above fully off.
41
+ *
42
+ * Edges: hwui's blur smears whatever surrounds the recorded content inward by its reach, and when
43
+ * the content underfills the node that surround is transparent black. [extendEffect] fills the
44
+ * padding with the content's clamped edge pixels first — clamp-to-edge, what the blur itself does
45
+ * at the node's own bounds — so every blur stage is clean right up to the content edge and the
46
+ * glass may read there. Before this the glass stayed a full blur reach inside the content, which
47
+ * copied the row or column at the inset across everything nearer the edge.
48
+ */
49
+ @RequiresApi(Build.VERSION_CODES.TIRAMISU)
50
+ internal object GlassProgressiveBlur {
51
+
52
+ const val OFFSET = "offset"
53
+ const val CROP = "crop"
54
+ const val RAMP_RADII = "rampRadii"
55
+ const val RAMP_LINE = "rampLine"
56
+ const val LEVEL_RADII = "levelRadii"
57
+
58
+ /**
59
+ * The smallest level's radius, px: sigma ≈ 2.25 px, close enough to sharp that the crossfade
60
+ * from the original reads as softening rather than as a double image.
61
+ */
62
+ private const val BASE_LEVEL_PX = 4.5f
63
+
64
+ /** Levels above the original. Six reach 4.5 .. 144 px by doublings; a wider ramp starts higher. */
65
+ private const val MAX_LEVELS = 6
66
+
67
+ private val WEIGHT_SOURCE = """
68
+ uniform shader content;
69
+ uniform float2 offset; // (-P, -P): node-local to view-local, like the glass shader
70
+ uniform float2 rampRadii; // (leading, trailing) radius, px
71
+ uniform float4 rampLine; // xy = view-local px where the ramp begins, zw = unitDir / rampLen
72
+ uniform float2 levelRadii; // (radius of the level below, radius of this level), px
73
+
74
+ half4 main(float2 fragCoord) {
75
+ float2 pixels = fragCoord + offset;
76
+
77
+ // Hermite-eased ramp position along the axis, then the local radius.
78
+ float t = clamp(dot(pixels - rampLine.xy, rampLine.zw), 0.0, 1.0);
79
+ t = t * t * (3.0 - 2.0 * t);
80
+ float radius = mix(rampRadii.x, rampRadii.y, t);
81
+
82
+ float w = clamp((radius - levelRadii.x) / (levelRadii.y - levelRadii.x), 0.0, 1.0);
83
+ if (w <= 0.0) {
84
+ return half4(0.0);
85
+ }
86
+ // Premultiplied in, premultiplied out: scaling colour and alpha together is what makes
87
+ // SRC_OVER of this over the level below a plain lerp.
88
+ return half4(float4(content.eval(fragCoord)) * w);
89
+ }
90
+ """.trimIndent()
91
+
92
+ private val EXTEND_SOURCE = """
93
+ uniform shader content;
94
+ uniform float4 crop; // node-space content rect (minX, minY, maxX, maxY), px
95
+
96
+ half4 main(float2 fragCoord) {
97
+ return content.eval(clamp(fragCoord, crop.xy, crop.zw));
98
+ }
99
+ """.trimIndent()
100
+
101
+ private var weightShader: RuntimeShader? = null
102
+ private var weightAttempted = false
103
+ private var extendShader: RuntimeShader? = null
104
+ private var extendAttempted = false
105
+
106
+ /** Present-but-null = the compile failed once; don't retry, callers fall back. */
107
+ @Synchronized
108
+ private fun weightOrNull(): RuntimeShader? {
109
+ if (weightAttempted) return weightShader
110
+ weightAttempted = true
111
+ weightShader = try {
112
+ RuntimeShader(WEIGHT_SOURCE)
113
+ } catch (t: Throwable) {
114
+ Log.e(LOG_TAG, "Progressive blur weight AGSL failed to compile; progressive blur falls back", t)
115
+ null
116
+ }
117
+ return weightShader
118
+ }
119
+
120
+ @Synchronized
121
+ private fun extendOrNull(): RuntimeShader? {
122
+ if (extendAttempted) return extendShader
123
+ extendAttempted = true
124
+ extendShader = try {
125
+ RuntimeShader(EXTEND_SOURCE)
126
+ } catch (t: Throwable) {
127
+ Log.e(LOG_TAG, "Edge-extension AGSL failed to compile; blur edges stay unextended", t)
128
+ null
129
+ }
130
+ return extendShader
131
+ }
132
+
133
+ /** The natural level count for a ramp whose widest radius is [maxPx]: one per doubling from [BASE_LEVEL_PX]. */
134
+ fun levelCount(maxPx: Float): Int {
135
+ if (maxPx <= BASE_LEVEL_PX) return 1
136
+ return min(MAX_LEVELS, ceil(ln(maxPx / BASE_LEVEL_PX) / ln(2f)).toInt() + 1)
137
+ }
138
+
139
+ /**
140
+ * Levels the quality tier pays for. Each level is a full-node hwui blur, a weight pass and a
141
+ * blend — measured at ~10 ms per level for two full-width scrims covering 440 dp of a 1080×2400
142
+ * screen on an Adreno 610, against a 23 ms floor for the glass pass alone over the same nodes —
143
+ * so this is the knob that fits the ramp to a device. One level is a plain crossfade between the
144
+ * original and the widest blur and reads as grey crisp text over a haze; two is the least that
145
+ * reads as a melt; three is where it stops improving visibly. LOW is what a view covering more
146
+ * than a quarter of the screen resolves to on its own (see LiquidGlassView.resolveShaderQuality).
147
+ */
148
+ fun levelBudget(quality: ShaderQuality): Int = when (quality) {
149
+ ShaderQuality.LOW -> 2
150
+ ShaderQuality.MEDIUM -> 3
151
+ ShaderQuality.HIGH -> MAX_LEVELS
152
+ }
153
+
154
+ /**
155
+ * Level radii, widest last. A crossfade between two Gaussians reads as one blur of some width
156
+ * in between while their sigmas stay within a few-fold of each other, and as a double image
157
+ * beyond that — so few levels spread by 4× or 3×, and four or more run geometrically from
158
+ * [BASE_LEVEL_PX] up to the top, where the first step from the original is too small to see.
159
+ */
160
+ fun levelRadii(maxPx: Float, budget: Int): FloatArray {
161
+ val n = max(1, min(budget, levelCount(maxPx)))
162
+ return when (n) {
163
+ 1 -> floatArrayOf(maxPx)
164
+ 2 -> floatArrayOf(maxPx / 4f, maxPx)
165
+ 3 -> floatArrayOf(maxPx / 9f, maxPx / 3f, maxPx)
166
+ else -> {
167
+ val ratio = (maxPx / BASE_LEVEL_PX).pow(1f / (n - 1))
168
+ FloatArray(n) { k -> BASE_LEVEL_PX * ratio.pow(k) }
169
+ }
170
+ }
171
+ }
172
+
173
+ /**
174
+ * The clamp-to-edge fill: every pixel of the node outside [crop] takes the nearest content
175
+ * pixel. Null when the shader is unusable, in which case blur edges are simply not extended.
176
+ *
177
+ * @param crop node-space content rect, half a pixel in — the same rect the glass clamps to.
178
+ */
179
+ fun extendEffect(crop: FloatArray): RenderEffect? {
180
+ val shader = extendOrNull() ?: return null
181
+ return try {
182
+ shader.setFloatUniform(CROP, crop[0], crop[1], crop[2], crop[3])
183
+ RenderEffect.createRuntimeShaderEffect(shader, "content")
184
+ } catch (t: Throwable) {
185
+ Log.e(LOG_TAG, "Edge-extension effect failed to build; blur edges stay unextended", t)
186
+ null
187
+ }
188
+ }
189
+
190
+ /**
191
+ * The pyramid, or null when the weight shader is unusable (callers substitute a uniform hwui
192
+ * blur at [GlassAppearance.fallbackBlurPx]).
193
+ *
194
+ * @param widthPx view width, px — not the padded node's.
195
+ * @param heightPx view height, px.
196
+ * @param padPx padding on each side of the node.
197
+ */
198
+ fun buildEffect(
199
+ appearance: GlassAppearance,
200
+ quality: ShaderQuality,
201
+ widthPx: Float,
202
+ heightPx: Float,
203
+ padPx: Float
204
+ ): RenderEffect? {
205
+ val shader = weightOrNull() ?: return null
206
+
207
+ val maxPx = max(appearance.progStartPx, appearance.progEndPx)
208
+ val radii = levelRadii(maxPx, levelBudget(quality))
209
+
210
+ val direction = appearance.progDirection
211
+ val extent = if (direction.vertical) heightPx else widthPx
212
+ val rampLen = max((appearance.progRampEnd - appearance.progRampStart) * extent, 1e-3f)
213
+ val lead = appearance.progRampStart * extent
214
+
215
+ // The origin sits on the leading edge of the ramp window; the direction vector carries the
216
+ // inverse length so the shader's dot() lands directly in 0..1.
217
+ val originX = if (direction.vertical) 0f else if (direction.reversed) widthPx - lead else lead
218
+ val originY = if (!direction.vertical) 0f else if (direction.reversed) heightPx - lead else lead
219
+ val sign = if (direction.reversed) -1f else 1f
220
+ val dirX = if (direction.vertical) 0f else sign / rampLen
221
+ val dirY = if (direction.vertical) sign / rampLen else 0f
222
+
223
+ return try {
224
+ // Innermost: the original, untouched — what the sharp end of the ramp shows.
225
+ var stack: RenderEffect = RenderEffect.createOffsetEffect(0f, 0f)
226
+ var below = 0f
227
+ for (radiusPx in radii) {
228
+ val hwui = appearance.hwuiRadius(radiusPx)
229
+ if (hwui <= 0f) continue
230
+ // createRuntimeShaderEffect snapshots the uniforms, so one shader serves every level.
231
+ shader.setFloatUniform(OFFSET, -padPx, -padPx)
232
+ shader.setFloatUniform(RAMP_RADII, appearance.progStartPx, appearance.progEndPx)
233
+ shader.setFloatUniform(RAMP_LINE, originX, originY, dirX, dirY)
234
+ shader.setFloatUniform(LEVEL_RADII, below, radiusPx)
235
+ // createChainEffect(outer, inner) runs `inner` first: blur, then weight.
236
+ val weighted = RenderEffect.createChainEffect(
237
+ RenderEffect.createRuntimeShaderEffect(shader, "content"),
238
+ RenderEffect.createBlurEffect(hwui, hwui, Shader.TileMode.CLAMP)
239
+ )
240
+ stack = RenderEffect.createBlendModeEffect(stack, weighted, BlendMode.SRC_OVER)
241
+ below = radiusPx
242
+ }
243
+ stack
244
+ } catch (t: Throwable) {
245
+ Log.e(LOG_TAG, "Progressive blur pyramid failed to build; progressive blur falls back", t)
246
+ null
247
+ }
248
+ }
249
+ }
@@ -0,0 +1,256 @@
1
+ package expo.modules.liquidglass.glass
2
+
3
+ import android.graphics.Color
4
+ import android.graphics.HardwareRenderer
5
+ import android.graphics.PixelFormat
6
+ import android.graphics.RenderEffect
7
+ import android.graphics.RenderNode
8
+ import android.graphics.RuntimeShader
9
+ import android.hardware.HardwareBuffer
10
+ import android.media.ImageReader
11
+ import android.os.Build
12
+ import android.util.Log
13
+ import androidx.annotation.RequiresApi
14
+ import expo.modules.liquidglass.LOG_TAG
15
+
16
+ /**
17
+ * One compiled [RuntimeShader] per [ShaderQuality], shared process-wide.
18
+ *
19
+ * Sharing is safe because every glass view uploads its uniforms and creates its
20
+ * [android.graphics.RenderEffect] back to back on the UI thread, and
21
+ * `createRuntimeShaderEffect` snapshots the uniform values by value at creation time — a later
22
+ * upload by another view cannot reach into an effect that has already been built.
23
+ *
24
+ * Constructing a [RuntimeShader] only parses SkSL; the driver's real compile happens lazily on the
25
+ * RenderThread at first draw. [warmUp] does both, and does the second one against a scratch surface
26
+ * it can read back — see [probeDriver].
27
+ */
28
+ @RequiresApi(Build.VERSION_CODES.TIRAMISU)
29
+ internal object GlassShaderCache {
30
+
31
+ private class Entry(val variant: GlassShaderVariant, val shader: RuntimeShader)
32
+
33
+ /** Absent = not attempted yet. Present-but-null = unusable; do not retry. */
34
+ private val entries = HashMap<ShaderQuality, Entry?>()
35
+
36
+ @Synchronized
37
+ private fun entry(quality: ShaderQuality): Entry? {
38
+ if (entries.containsKey(quality)) return entries[quality]
39
+ val variant = GlassShaderSource.variant(quality)
40
+ val entry = try {
41
+ Entry(variant, RuntimeShader(variant.source))
42
+ } catch (t: Throwable) {
43
+ // RuntimeShader's constructor throws IllegalArgumentException carrying the full SkSL error
44
+ // log. Anything else here is a driver/platform surprise, and a crash would be worse than a
45
+ // downgraded tier, so catch broadly.
46
+ Log.e(LOG_TAG, "AGSL shader failed to compile (quality=$quality); falling back", t)
47
+ null
48
+ }
49
+ entries[quality] = entry
50
+ return entry
51
+ }
52
+
53
+ @Synchronized
54
+ private fun disable(quality: ShaderQuality) {
55
+ entries[quality] = null
56
+ }
57
+
58
+ fun variantOrNull(quality: ShaderQuality): GlassShaderVariant? = entry(quality)?.variant
59
+
60
+ fun shaderOrNull(quality: ShaderQuality): RuntimeShader? = entry(quality)?.shader
61
+
62
+ fun isAvailable(quality: ShaderQuality): Boolean = entry(quality) != null
63
+
64
+ /**
65
+ * Compiles every tier, then verifies each one actually renders.
66
+ *
67
+ * The parse runs here, synchronously, so a bad string interpolation in a tier this device never
68
+ * selects still fails loudly on the developer's machine rather than on one user's phone.
69
+ *
70
+ * The render probe runs on a background thread, because it costs a scratch surface and a real
71
+ * GPU round trip. It is the only way to catch a **silent** driver failure: stage-4 compilation
72
+ * happens on the RenderThread and throws no Java exception, so without a probe the first symptom
73
+ * is an invisible or black glass view on one specific chipset.
74
+ */
75
+ fun warmUp() {
76
+ for (quality in ShaderQuality.entries) entry(quality)
77
+
78
+ Thread({
79
+ for (quality in ShaderQuality.entries) {
80
+ val entry = entry(quality) ?: continue
81
+ if (probeDriver(entry.variant) == ProbeResult.FAILED) {
82
+ Log.e(
83
+ LOG_TAG,
84
+ "The AGSL shader compiled but rendered nothing on this GPU (quality=$quality). " +
85
+ "Falling back to the blur tier."
86
+ )
87
+ disable(quality)
88
+ }
89
+ }
90
+ }, "ExpoLiquidGlassWarmUp").apply {
91
+ isDaemon = true
92
+ priority = Thread.MIN_PRIORITY
93
+ start()
94
+ }
95
+ }
96
+
97
+ private enum class ProbeResult {
98
+ /** The probe drew and the pixel is non-transparent. */
99
+ OK,
100
+
101
+ /** The probe drew and the pixel is transparent — the driver produced nothing. */
102
+ FAILED,
103
+
104
+ /** The probe could not be run or read. Says nothing about the shader; keep the tier. */
105
+ INCONCLUSIVE
106
+ }
107
+
108
+ /**
109
+ * Renders the shader once over an opaque white input and reads the centre pixel back.
110
+ *
111
+ * Uses its *own* [RuntimeShader] rather than the shared one, so that priming uniforms off the UI
112
+ * thread cannot race a glass view building a real effect.
113
+ *
114
+ * Only a pixel that reads back fully transparent counts as a failure. At the centre of the probe
115
+ * the signed distance is far inside the shape, so `shapeAlpha` is 1 and `glassOpacity` is 1 —
116
+ * alpha 0 there is not reachable by any correct evaluation of this shader. Anything that stops
117
+ * the probe from running at all is [ProbeResult.INCONCLUSIVE], never a demotion: wrongly
118
+ * demoting a working device costs every user the refraction.
119
+ */
120
+ private fun probeDriver(variant: GlassShaderVariant): ProbeResult {
121
+ var reader: ImageReader? = null
122
+ var renderer: HardwareRenderer? = null
123
+ try {
124
+ reader = ImageReader.newInstance(
125
+ PROBE_PX,
126
+ PROBE_PX,
127
+ PixelFormat.RGBA_8888,
128
+ 2,
129
+ HardwareBuffer.USAGE_GPU_COLOR_OUTPUT or
130
+ HardwareBuffer.USAGE_GPU_SAMPLED_IMAGE or
131
+ HardwareBuffer.USAGE_CPU_READ_OFTEN
132
+ )
133
+
134
+ val shader = RuntimeShader(variant.source)
135
+ primeUniforms(shader, variant.liveUniforms)
136
+
137
+ val node = RenderNode("GlassShaderProbe")
138
+ node.setPosition(0, 0, PROBE_PX, PROBE_PX)
139
+ val canvas = node.beginRecording(PROBE_PX, PROBE_PX)
140
+ try {
141
+ canvas.drawColor(Color.WHITE)
142
+ } finally {
143
+ node.endRecording()
144
+ }
145
+ node.setRenderEffect(RenderEffect.createRuntimeShaderEffect(shader, "content"))
146
+
147
+ renderer = HardwareRenderer()
148
+ renderer.setSurface(reader.surface)
149
+ renderer.setContentRoot(node)
150
+ renderer.createRenderRequest().setWaitForPresent(true).syncAndDraw()
151
+
152
+ val image = reader.acquireNextImage() ?: return ProbeResult.INCONCLUSIVE
153
+ try {
154
+ val plane = image.planes[0]
155
+ val buffer = plane.buffer
156
+ val centre = (PROBE_PX / 2) * plane.rowStride + (PROBE_PX / 2) * plane.pixelStride
157
+ if (centre + 3 >= buffer.limit()) return ProbeResult.INCONCLUSIVE
158
+ val alpha = buffer.get(centre + 3).toInt() and 0xFF
159
+ return if (alpha == 0) ProbeResult.FAILED else ProbeResult.OK
160
+ } finally {
161
+ image.close()
162
+ }
163
+ } catch (t: Throwable) {
164
+ GlassDebug.log("Shader render probe could not run: $t")
165
+ return ProbeResult.INCONCLUSIVE
166
+ } finally {
167
+ try {
168
+ renderer?.destroy()
169
+ } catch (_: Throwable) {
170
+ // Nothing useful to do; the probe is best-effort.
171
+ }
172
+ reader?.close()
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Plausible values for every uniform the variant kept.
178
+ *
179
+ * Chosen so the probe reaches the expensive branches — `dispersionAmount` is above
180
+ * `2 * unitScale`, which is what the shader's own cutoff tests — because the point is to make the
181
+ * driver compile the whole program, not a cheap subset of it.
182
+ */
183
+ private fun primeUniforms(shader: RuntimeShader, live: Set<String>) {
184
+ fun set(name: String, value: Float) {
185
+ if (name in live) shader.setFloatUniform(name, value)
186
+ }
187
+
188
+ fun set(name: String, a: Float, b: Float) {
189
+ if (name in live) shader.setFloatUniform(name, a, b)
190
+ }
191
+
192
+ fun set(name: String, a: Float, b: Float, c: Float) {
193
+ if (name in live) shader.setFloatUniform(name, a, b, c)
194
+ }
195
+
196
+ fun set(name: String, a: Float, b: Float, c: Float, d: Float) {
197
+ if (name in live) shader.setFloatUniform(name, a, b, c, d)
198
+ }
199
+
200
+ val size = PROBE_PX.toFloat()
201
+ set(GlassShaderSource.SIZE, size, size)
202
+ set(GlassShaderSource.OFFSET, 0f, 0f)
203
+ set(GlassShaderSource.CROP, 0.5f, 0.5f, size - 0.5f, size - 0.5f)
204
+ // Continuous-corner values, not circular: the probe must make the driver compile the
205
+ // superellipse pow() branch, which is exactly the kind of path a driver miscompiles silently.
206
+ set(GlassShaderSource.CORNER_EXTENTS, 12f, 12f, 12f, 12f)
207
+ set(GlassShaderSource.CORNER_SHAPES, 3.3418f, 3.3418f, 3.3418f, 3.3418f)
208
+ set(GlassShaderSource.UNIT_SCALE, 3f)
209
+ set(GlassShaderSource.REFRACTION_SCALE, 12f, 12f)
210
+ set(GlassShaderSource.REFRACTION_AMOUNT, 16f)
211
+ set(GlassShaderSource.REFRACTION_SWIRL, 0.25f)
212
+ set(GlassShaderSource.DEPTH_EFFECT, 1f)
213
+ set(GlassShaderSource.PROFILE_POWER, 1f)
214
+ set(GlassShaderSource.PROFILE_BIAS, 0f)
215
+ set(GlassShaderSource.DISPERSION_HEIGHT, 12f)
216
+ set(GlassShaderSource.DISPERSION_AMOUNT, 18f)
217
+ set(GlassShaderSource.DISPERSION_TAP_SPACING, 3f)
218
+ set(GlassShaderSource.TINT_COLOR, 0f, 0f, 0f, 0f)
219
+ set(GlassShaderSource.FROST_COLOR, 1f, 1f, 1f, 0.36f)
220
+ set(GlassShaderSource.HIGHLIGHT_INTENSITY, 0.25f)
221
+ set(GlassShaderSource.HIGHLIGHT_DIR, -0.7071f, 0.7071f)
222
+ // Missing from the original list, live in every tier since the highlight remodel — which made
223
+ // the probe throw at draw, land in the broad catch, and report INCONCLUSIVE on every device.
224
+ // The silent-driver-failure detection was itself failing silently.
225
+ set(GlassShaderSource.HIGHLIGHT_WIDTH, 12f)
226
+ set(GlassShaderSource.HIGHLIGHT_FALLOFF, 1f)
227
+ set(GlassShaderSource.LIGHT_INTENSITY, 0f)
228
+ set(GlassShaderSource.GLASS_OPACITY, 1f)
229
+ set(GlassShaderSource.SATURATION, 1.8f)
230
+ // Above 1 so the probe exercises the HDR glint arithmetic; the probe surface is SDR, which
231
+ // is fine — out-of-range values just clamp at readback.
232
+ set(GlassShaderSource.HDR_HEADROOM, 2f)
233
+ set(GlassShaderSource.NOISE_AMOUNT, 0.05f)
234
+ // Glow ON in the probe, so the driver compiles the interactive branch too.
235
+ set(GlassShaderSource.TOUCH_POS, 32f, 32f)
236
+ set(GlassShaderSource.TOUCH_GLOW, 1f)
237
+ // The lens gate joined the glow work but never joined this list — the exact failure mode the
238
+ // HIGHLIGHT_WIDTH comment above documents: the probe threw at draw, the broad catch reported
239
+ // INCONCLUSIVE on every device, and the silent-failure detector was itself failing silently.
240
+ set(GlassShaderSource.TOUCH_LENS, 1f)
241
+ // Morph ON, so the driver compiles the smooth-min fold and the second gradient too. The
242
+ // partner half-extents (16 px) overlap the shape from (16, 16), and smoothing is non-zero.
243
+ set(GlassShaderSource.SHAPE_RECT, 0f, 0f, size * 0.5f, size * 0.5f)
244
+ set(GlassShaderSource.MORPH_RECT, 16f, 16f, 16f, 16f)
245
+ set(GlassShaderSource.MORPH_SHAPE, 8f, 12f)
246
+ // Inner shadow ON and a real magnification, so the driver compiles the shifted merged-field
247
+ // evaluation and the sampling remap too — every uniform this shader declares is set here,
248
+ // because a declared-but-unset one throws at draw and demotes the tier silently.
249
+ set(GlassShaderSource.INNER_SHADOW_COLOR, 0f, 0f, 0f, 0.15f)
250
+ set(GlassShaderSource.INNER_SHADOW_GEOM, 6f, 0f, 6f)
251
+ set(GlassShaderSource.MAGNIFICATION, 1.2f)
252
+ }
253
+
254
+ /** Large enough that the centre pixel is unambiguously inside the shape, small enough to be free. */
255
+ private const val PROBE_PX = 64
256
+ }