glacia-native 0.5.2 → 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 (381) hide show
  1. package/README.md +84 -17
  2. package/lib/module/Accordion.js +58 -0
  3. package/lib/module/ActionSheet.js +38 -0
  4. package/lib/module/Alert.js +23 -0
  5. package/lib/module/AlertDialog.js +47 -0
  6. package/lib/module/Avatar.js +48 -0
  7. package/lib/module/Badge.js +36 -0
  8. package/lib/module/Bars.js +13 -268
  9. package/lib/module/Button.js +57 -39
  10. package/lib/module/Card.js +31 -19
  11. package/lib/module/Checkbox.js +42 -0
  12. package/lib/module/Chip.js +80 -0
  13. package/lib/module/Collapsible.js +26 -0
  14. package/lib/module/ContextMenu.js +33 -0
  15. package/lib/module/Dialog.js +39 -123
  16. package/lib/module/DropdownMenu.js +33 -0
  17. package/lib/module/Field.js +22 -0
  18. package/lib/module/Glass.js +10 -3
  19. package/lib/module/Group.js +36 -0
  20. package/lib/module/IconButton.js +40 -0
  21. package/lib/module/Input.js +43 -38
  22. package/lib/module/Label.js +17 -0
  23. package/lib/module/MorphGroup.js +47 -0
  24. package/lib/module/Popover.js +29 -0
  25. package/lib/module/Progress.js +32 -0
  26. package/lib/module/RadioGroup.js +51 -0
  27. package/lib/module/Scrim.js +44 -0
  28. package/lib/module/SegmentedControl.js +70 -63
  29. package/lib/module/Select.js +51 -0
  30. package/lib/module/Separator.js +25 -0
  31. package/lib/module/Sheet.js +51 -0
  32. package/lib/module/Skeleton.js +48 -0
  33. package/lib/module/Slider.js +45 -34
  34. package/lib/module/Stepper.js +167 -0
  35. package/lib/module/Switch.js +45 -55
  36. package/lib/module/TabBar.js +50 -44
  37. package/lib/module/Textarea.js +18 -0
  38. package/lib/module/Toast.js +55 -0
  39. package/lib/module/Toggle.js +47 -0
  40. package/lib/module/ToggleGroup.js +56 -0
  41. package/lib/module/Toolbar.js +37 -0
  42. package/lib/module/Tooltip.js +31 -0
  43. package/lib/module/glass-provider.js +28 -0
  44. package/lib/module/glass-stack.js +61 -0
  45. package/lib/module/index.js +78 -109
  46. package/lib/module/internal/GlassBackdrop.js +36 -0
  47. package/lib/module/internal/GlassView.js +43 -11
  48. package/lib/module/internal/blur-community.js +20 -0
  49. package/lib/module/internal/blur-community.web.js +9 -0
  50. package/lib/module/internal/blur.js +6 -9
  51. package/lib/module/internal/glass-routing.js +154 -30
  52. package/lib/module/internal/initials.js +12 -0
  53. package/lib/module/internal/overlay.js +147 -0
  54. package/lib/module/internal/primitives.js +16 -0
  55. package/lib/typescript/Accordion.d.ts +22 -0
  56. package/lib/typescript/ActionSheet.d.ts +24 -0
  57. package/lib/typescript/Alert.d.ts +15 -0
  58. package/lib/typescript/AlertDialog.d.ts +17 -0
  59. package/lib/typescript/Avatar.d.ts +22 -0
  60. package/lib/typescript/Badge.d.ts +12 -0
  61. package/lib/typescript/Bars.d.ts +3 -188
  62. package/lib/typescript/Button.d.ts +44 -10
  63. package/lib/typescript/Card.d.ts +30 -3
  64. package/lib/typescript/Checkbox.d.ts +14 -0
  65. package/lib/typescript/Chip.d.ts +19 -0
  66. package/lib/typescript/Collapsible.d.ts +17 -0
  67. package/lib/typescript/ContextMenu.d.ts +23 -0
  68. package/lib/typescript/Dialog.d.ts +8 -68
  69. package/lib/typescript/DropdownMenu.d.ts +23 -0
  70. package/lib/typescript/Field.d.ts +19 -0
  71. package/lib/typescript/Glass.d.ts +11 -2
  72. package/lib/typescript/Group.d.ts +35 -0
  73. package/lib/typescript/IconButton.d.ts +21 -0
  74. package/lib/typescript/Input.d.ts +17 -18
  75. package/lib/typescript/Label.d.ts +14 -0
  76. package/lib/typescript/MorphGroup.d.ts +46 -0
  77. package/lib/typescript/Popover.d.ts +17 -0
  78. package/lib/typescript/Progress.d.ts +13 -0
  79. package/lib/typescript/RadioGroup.d.ts +21 -0
  80. package/lib/typescript/Scrim.d.ts +33 -0
  81. package/lib/typescript/SegmentedControl.d.ts +24 -13
  82. package/lib/typescript/Select.d.ts +19 -0
  83. package/lib/typescript/Separator.d.ts +10 -0
  84. package/lib/typescript/Sheet.d.ts +45 -0
  85. package/lib/typescript/Skeleton.d.ts +10 -0
  86. package/lib/typescript/Slider.d.ts +15 -7
  87. package/lib/typescript/Stepper.d.ts +49 -0
  88. package/lib/typescript/Switch.d.ts +19 -12
  89. package/lib/typescript/TabBar.d.ts +18 -6
  90. package/lib/typescript/Textarea.d.ts +6 -0
  91. package/lib/typescript/Toast.d.ts +40 -0
  92. package/lib/typescript/Toggle.d.ts +21 -0
  93. package/lib/typescript/ToggleGroup.d.ts +22 -0
  94. package/lib/typescript/Toolbar.d.ts +35 -0
  95. package/lib/typescript/Tooltip.d.ts +16 -0
  96. package/lib/typescript/glass-provider.d.ts +34 -0
  97. package/lib/typescript/glass-stack.d.ts +54 -0
  98. package/lib/typescript/index.d.ts +38 -17
  99. package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
  100. package/lib/typescript/internal/GlassView.d.ts +18 -2
  101. package/lib/typescript/internal/blur-community.d.ts +2 -0
  102. package/lib/typescript/internal/blur-community.web.d.ts +2 -0
  103. package/lib/typescript/internal/glass-routing.d.ts +83 -15
  104. package/lib/typescript/internal/initials.d.ts +2 -0
  105. package/lib/typescript/internal/overlay.d.ts +74 -0
  106. package/lib/typescript/internal/primitives.d.ts +11 -0
  107. package/package.json +4 -2
  108. package/src/Accordion.tsx +165 -0
  109. package/src/ActionSheet.tsx +149 -0
  110. package/src/Alert.tsx +85 -0
  111. package/src/AlertDialog.tsx +124 -0
  112. package/src/Avatar.tsx +102 -0
  113. package/src/Badge.tsx +80 -0
  114. package/src/Bars.tsx +10 -807
  115. package/src/Button.tsx +196 -67
  116. package/src/Card.tsx +105 -32
  117. package/src/Checkbox.tsx +98 -0
  118. package/src/Chip.tsx +149 -0
  119. package/src/Collapsible.tsx +66 -0
  120. package/src/ContextMenu.tsx +103 -0
  121. package/src/Dialog.tsx +85 -335
  122. package/src/DropdownMenu.tsx +103 -0
  123. package/src/Field.tsx +65 -0
  124. package/src/Glass.tsx +15 -5
  125. package/src/Group.tsx +98 -0
  126. package/src/IconButton.tsx +110 -0
  127. package/src/Input.tsx +139 -87
  128. package/src/Label.tsx +56 -0
  129. package/src/MorphGroup.tsx +134 -0
  130. package/src/Popover.tsx +81 -0
  131. package/src/Progress.tsx +83 -0
  132. package/src/RadioGroup.tsx +122 -0
  133. package/src/Scrim.tsx +94 -0
  134. package/src/SegmentedControl.tsx +132 -99
  135. package/src/Select.tsx +136 -0
  136. package/src/Separator.tsx +52 -0
  137. package/src/Sheet.tsx +139 -0
  138. package/src/Skeleton.tsx +77 -0
  139. package/src/Slider.tsx +84 -47
  140. package/src/Stepper.tsx +315 -0
  141. package/src/Switch.tsx +81 -73
  142. package/src/TabBar.tsx +106 -93
  143. package/src/Textarea.tsx +34 -0
  144. package/src/Toast.tsx +131 -0
  145. package/src/Toggle.tsx +113 -0
  146. package/src/ToggleGroup.tsx +129 -0
  147. package/src/Toolbar.tsx +111 -0
  148. package/src/Tooltip.tsx +79 -0
  149. package/src/engine/CHANGELOG.md +430 -0
  150. package/src/engine/NOTICE +54 -0
  151. package/src/engine/README.md +975 -0
  152. package/src/engine/android/build.gradle +18 -0
  153. package/src/engine/android/src/main/AndroidManifest.xml +2 -0
  154. package/src/engine/android/src/main/java/expo/modules/liquidglass/ExpoLiquidGlassModule.kt +174 -0
  155. package/src/engine/android/src/main/java/expo/modules/liquidglass/GlassConstants.kt +7 -0
  156. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassContainerView.kt +16 -0
  157. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassProviderView.kt +165 -0
  158. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassView.kt +1731 -0
  159. package/src/engine/android/src/main/java/expo/modules/liquidglass/enums/GlassEnums.kt +171 -0
  160. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropGraph.kt +146 -0
  161. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropSource.kt +53 -0
  162. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ContinuousCorners.kt +188 -0
  163. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/CornerRadii.kt +62 -0
  164. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassAppearance.kt +352 -0
  165. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassDebug.kt +109 -0
  166. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassEnvironment.kt +139 -0
  167. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassHdr.kt +85 -0
  168. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassLuminanceProbe.kt +189 -0
  169. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassPressAnimator.kt +264 -0
  170. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassProgressiveBlur.kt +249 -0
  171. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderCache.kt +256 -0
  172. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderSource.kt +845 -0
  173. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassTier.kt +63 -0
  174. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ProviderRegistry.kt +71 -0
  175. package/src/engine/android/src/main/java/expo/modules/liquidglass/records/GlassRecords.kt +288 -0
  176. package/src/engine/index.ts +24 -0
  177. package/src/engine/ios/Enums/GlassBlurDirection.swift +21 -0
  178. package/src/engine/ios/Enums/GlassVariant.swift +86 -0
  179. package/src/engine/ios/ExpoLiquidGlass.podspec +93 -0
  180. package/src/engine/ios/ExpoLiquidGlassModule.swift +77 -0
  181. package/src/engine/ios/Glass/BackdropCapturer.swift +811 -0
  182. package/src/engine/ios/Glass/ContinuousCorners.swift +165 -0
  183. package/src/engine/ios/Glass/GlassBackdrop.swift +176 -0
  184. package/src/engine/ios/Glass/GlassFramePhase.swift +126 -0
  185. package/src/engine/ios/Glass/GlassFrameScheduler.swift +261 -0
  186. package/src/engine/ios/Glass/GlassPressAnimator.swift +250 -0
  187. package/src/engine/ios/Glass/GlassRenderContext.swift +168 -0
  188. package/src/engine/ios/Glass/GlassRenderer.swift +186 -0
  189. package/src/engine/ios/Glass/GlassSurfaceView.swift +452 -0
  190. package/src/engine/ios/Glass/NonRenderableView.swift +54 -0
  191. package/src/engine/ios/Glass/StripCache.swift +545 -0
  192. package/src/engine/ios/Records/GlassCornerRadii.swift +79 -0
  193. package/src/engine/ios/Records/GlassMetalOptions.swift +180 -0
  194. package/src/engine/ios/Records/GlassRefractionCurve.swift +14 -0
  195. package/src/engine/ios/Shaders/LiquidGlass.metal +480 -0
  196. package/src/engine/ios/Shaders/bundle-marker.txt +6 -0
  197. package/src/engine/ios/Views/LiquidGlassContainerView.swift +99 -0
  198. package/src/engine/ios/Views/LiquidGlassView.swift +859 -0
  199. package/src/engine/package.json +70 -0
  200. package/src/engine/src/components/LiquidGlassButton/LiquidGlassButton.tsx +424 -0
  201. package/src/engine/src/components/LiquidGlassCard/LiquidGlassCard.tsx +98 -0
  202. package/src/engine/src/components/LiquidGlassChip/LiquidGlassChip.tsx +65 -0
  203. package/src/engine/src/components/LiquidGlassGroup/LiquidGlassGroup.tsx +350 -0
  204. package/src/engine/src/components/LiquidGlassIconButton/LiquidGlassIconButton.tsx +24 -0
  205. package/src/engine/src/components/LiquidGlassMorphGroup/LiquidGlassMorphGroup.tsx +434 -0
  206. package/src/engine/src/components/LiquidGlassScrim/LiquidGlassScrim.tsx +100 -0
  207. package/src/engine/src/components/LiquidGlassSegmentedControl/LiquidGlassSegmentedControl.tsx +213 -0
  208. package/src/engine/src/components/LiquidGlassSheet/LiquidGlassSheet.tsx +218 -0
  209. package/src/engine/src/components/LiquidGlassSlider/LiquidGlassSlider.tsx +327 -0
  210. package/src/engine/src/components/LiquidGlassStepper/LiquidGlassStepper.tsx +321 -0
  211. package/src/engine/src/components/LiquidGlassSwitch/LiquidGlassSwitch.tsx +296 -0
  212. package/src/engine/src/components/LiquidGlassTabBar/LiquidGlassTabBar.tsx +952 -0
  213. package/src/engine/src/components/LiquidGlassTextInput/LiquidGlassTextInput.tsx +151 -0
  214. package/src/engine/src/components/LiquidGlassToast/LiquidGlassToast.tsx +169 -0
  215. package/src/engine/src/components/LiquidGlassToolbar/LiquidGlassToolbar.tsx +124 -0
  216. package/src/engine/src/components/index.ts +16 -0
  217. package/src/engine/src/constants/index.ts +4 -0
  218. package/src/engine/src/constants/metal.constants.ts +327 -0
  219. package/src/engine/src/constants/metrics.constants.ts +325 -0
  220. package/src/engine/src/constants/springs.constants.ts +107 -0
  221. package/src/engine/src/constants/styles.constants.ts +12 -0
  222. package/src/engine/src/context/glass-group.context.ts +65 -0
  223. package/src/engine/src/context/index.ts +6 -0
  224. package/src/engine/src/core/components/LiquidGlassContainer/LiquidGlassContainer.tsx +32 -0
  225. package/src/engine/src/core/components/LiquidGlassContainer/index.ts +1 -0
  226. package/src/engine/src/core/components/LiquidGlassProvider/LiquidGlassProvider.tsx +66 -0
  227. package/src/engine/src/core/components/LiquidGlassProvider/index.ts +1 -0
  228. package/src/engine/src/core/components/LiquidGlassStack/LiquidGlassStack.tsx +184 -0
  229. package/src/engine/src/core/components/LiquidGlassStack/index.ts +1 -0
  230. package/src/engine/src/core/components/LiquidGlassView/LiquidGlassView.tsx +126 -0
  231. package/src/engine/src/core/components/LiquidGlassView/index.ts +1 -0
  232. package/src/engine/src/core/components/index.ts +4 -0
  233. package/src/engine/src/core/constants/glass.constants.ts +57 -0
  234. package/src/engine/src/core/constants/index.ts +20 -0
  235. package/src/engine/src/core/constants/native.constants.ts +16 -0
  236. package/src/engine/src/core/context/glass-stack.context.ts +30 -0
  237. package/src/engine/src/core/context/index.ts +4 -0
  238. package/src/engine/src/core/enum/index.ts +12 -0
  239. package/src/engine/src/core/index.ts +1 -0
  240. package/src/engine/src/core/interfaces/glass-hdr.interface.ts +15 -0
  241. package/src/engine/src/core/interfaces/glass-metal.interface.ts +248 -0
  242. package/src/engine/src/core/interfaces/glass-surface.interface.ts +9 -0
  243. package/src/engine/src/core/interfaces/index.ts +31 -0
  244. package/src/engine/src/core/interfaces/liquid-glass-container.interface.ts +6 -0
  245. package/src/engine/src/core/interfaces/liquid-glass-provider.interface.ts +14 -0
  246. package/src/engine/src/core/interfaces/liquid-glass-stack.interface.ts +21 -0
  247. package/src/engine/src/core/interfaces/liquid-glass-view.interface.ts +129 -0
  248. package/src/engine/src/core/interfaces/native-liquid-glass-view.interface.ts +19 -0
  249. package/src/engine/src/core/modules/ExpoLiquidGlassModule.ts +26 -0
  250. package/src/engine/src/core/modules/index.ts +2 -0
  251. package/src/engine/src/core/root/index.ts +51 -0
  252. package/src/engine/src/core/types/glass.types.ts +25 -0
  253. package/src/engine/src/core/types/index.ts +8 -0
  254. package/src/engine/src/core/utils/debug.utils.ts +17 -0
  255. package/src/engine/src/core/utils/dev-warn.utils.ts +17 -0
  256. package/src/engine/src/core/utils/hdr.utils.ts +37 -0
  257. package/src/engine/src/core/utils/index.ts +5 -0
  258. package/src/engine/src/core/utils/native-view.utils.ts +33 -0
  259. package/src/engine/src/core/utils/platform.utils.ts +34 -0
  260. package/src/engine/src/core/views/NativeGlassBackdropView.ts +24 -0
  261. package/src/engine/src/core/views/NativeLiquidGlassContainerView.ts +13 -0
  262. package/src/engine/src/core/views/NativeLiquidGlassContainerView.web.ts +10 -0
  263. package/src/engine/src/core/views/NativeLiquidGlassProviderView.ts +13 -0
  264. package/src/engine/src/core/views/NativeLiquidGlassProviderView.web.ts +10 -0
  265. package/src/engine/src/core/views/NativeLiquidGlassView.ts +19 -0
  266. package/src/engine/src/core/views/NativeLiquidGlassView.web.ts +14 -0
  267. package/src/engine/src/core/views/index.ts +4 -0
  268. package/src/engine/src/hooks/index.ts +18 -0
  269. package/src/engine/src/hooks/use-adaptive-glass.ts +91 -0
  270. package/src/engine/src/hooks/use-damped-drag.ts +332 -0
  271. package/src/engine/src/hooks/use-echo-filter.ts +55 -0
  272. package/src/engine/src/hooks/use-glass-group-member.ts +169 -0
  273. package/src/engine/src/hooks/use-gravity-highlight.ts +79 -0
  274. package/src/engine/src/hooks/use-press-progress.ts +44 -0
  275. package/src/engine/src/index.ts +120 -0
  276. package/src/engine/src/interfaces/index.ts +28 -0
  277. package/src/engine/src/interfaces/liquid-glass-button.interface.ts +94 -0
  278. package/src/engine/src/interfaces/liquid-glass-card.interface.ts +40 -0
  279. package/src/engine/src/interfaces/liquid-glass-chip.interface.ts +29 -0
  280. package/src/engine/src/interfaces/liquid-glass-group.interface.ts +32 -0
  281. package/src/engine/src/interfaces/liquid-glass-icon-button.interface.ts +19 -0
  282. package/src/engine/src/interfaces/liquid-glass-morph-group.interface.ts +59 -0
  283. package/src/engine/src/interfaces/liquid-glass-scrim.interface.ts +36 -0
  284. package/src/engine/src/interfaces/liquid-glass-segmented-control.interface.ts +32 -0
  285. package/src/engine/src/interfaces/liquid-glass-sheet.interface.ts +38 -0
  286. package/src/engine/src/interfaces/liquid-glass-slider.interface.ts +37 -0
  287. package/src/engine/src/interfaces/liquid-glass-stepper.interface.ts +35 -0
  288. package/src/engine/src/interfaces/liquid-glass-switch.interface.ts +27 -0
  289. package/src/engine/src/interfaces/liquid-glass-tab-bar.interface.ts +116 -0
  290. package/src/engine/src/interfaces/liquid-glass-text-input.interface.ts +42 -0
  291. package/src/engine/src/interfaces/liquid-glass-toast.interface.ts +36 -0
  292. package/src/engine/src/interfaces/liquid-glass-toolbar.interface.ts +33 -0
  293. package/src/engine/src/theme/glass-ui-theme.ts +100 -0
  294. package/src/engine/src/theme/index.ts +2 -0
  295. package/src/engine/src/utils/button-press.utils.ts +63 -0
  296. package/src/engine/src/utils/index.ts +3 -0
  297. package/src/engine/src/utils/metal.utils.ts +164 -0
  298. package/src/glass-provider.tsx +60 -0
  299. package/src/glass-stack.tsx +115 -0
  300. package/src/index.ts +47 -190
  301. package/src/internal/GlassBackdrop.tsx +60 -0
  302. package/src/internal/GlassView.tsx +53 -18
  303. package/src/internal/blur-community.ts +19 -0
  304. package/src/internal/blur-community.web.ts +7 -0
  305. package/src/internal/blur.ts +7 -8
  306. package/src/internal/glass-routing.ts +211 -34
  307. package/src/internal/initials.ts +7 -0
  308. package/src/internal/overlay.tsx +258 -0
  309. package/src/internal/primitives.ts +23 -0
  310. package/lib/module/Carousel.js +0 -103
  311. package/lib/module/Display.js +0 -318
  312. package/lib/module/Feedback.js +0 -395
  313. package/lib/module/Form.js +0 -160
  314. package/lib/module/Forms2.js +0 -471
  315. package/lib/module/Message.js +0 -84
  316. package/lib/module/Overlays.js +0 -344
  317. package/lib/module/Pickers.js +0 -243
  318. package/lib/module/Table.js +0 -100
  319. package/lib/module/ai.js +0 -283
  320. package/lib/module/charts/AreaChart.js +0 -32
  321. package/lib/module/charts/BarChart.js +0 -75
  322. package/lib/module/charts/FunnelChart.js +0 -50
  323. package/lib/module/charts/HeatmapChart.js +0 -71
  324. package/lib/module/charts/LineChart.js +0 -81
  325. package/lib/module/charts/PlotChart.js +0 -52
  326. package/lib/module/charts/RadarChart.js +0 -78
  327. package/lib/module/charts/RingChart.js +0 -52
  328. package/lib/module/charts/ScatterChart.js +0 -95
  329. package/lib/module/charts/WaterfallChart.js +0 -85
  330. package/lib/module/charts/advanced.js +0 -313
  331. package/lib/module/charts/extra.js +0 -108
  332. package/lib/module/charts/index.js +0 -50
  333. package/lib/module/charts/scales.js +0 -140
  334. package/lib/typescript/Carousel.d.ts +0 -47
  335. package/lib/typescript/Display.d.ts +0 -178
  336. package/lib/typescript/Feedback.d.ts +0 -196
  337. package/lib/typescript/Form.d.ts +0 -97
  338. package/lib/typescript/Forms2.d.ts +0 -209
  339. package/lib/typescript/Message.d.ts +0 -67
  340. package/lib/typescript/Overlays.d.ts +0 -146
  341. package/lib/typescript/Pickers.d.ts +0 -105
  342. package/lib/typescript/Table.d.ts +0 -64
  343. package/lib/typescript/ai.d.ts +0 -166
  344. package/lib/typescript/charts/AreaChart.d.ts +0 -44
  345. package/lib/typescript/charts/BarChart.d.ts +0 -19
  346. package/lib/typescript/charts/FunnelChart.d.ts +0 -25
  347. package/lib/typescript/charts/HeatmapChart.d.ts +0 -23
  348. package/lib/typescript/charts/LineChart.d.ts +0 -30
  349. package/lib/typescript/charts/PlotChart.d.ts +0 -31
  350. package/lib/typescript/charts/RadarChart.d.ts +0 -27
  351. package/lib/typescript/charts/RingChart.d.ts +0 -28
  352. package/lib/typescript/charts/ScatterChart.d.ts +0 -34
  353. package/lib/typescript/charts/WaterfallChart.d.ts +0 -22
  354. package/lib/typescript/charts/advanced.d.ts +0 -107
  355. package/lib/typescript/charts/extra.d.ts +0 -63
  356. package/lib/typescript/charts/index.d.ts +0 -13
  357. package/lib/typescript/charts/scales.d.ts +0 -35
  358. package/src/Carousel.tsx +0 -233
  359. package/src/Display.tsx +0 -781
  360. package/src/Feedback.tsx +0 -992
  361. package/src/Form.tsx +0 -445
  362. package/src/Forms2.tsx +0 -1055
  363. package/src/Message.tsx +0 -218
  364. package/src/Overlays.tsx +0 -704
  365. package/src/Pickers.tsx +0 -595
  366. package/src/Table.tsx +0 -232
  367. package/src/ai.tsx +0 -715
  368. package/src/charts/AreaChart.tsx +0 -73
  369. package/src/charts/BarChart.tsx +0 -221
  370. package/src/charts/FunnelChart.tsx +0 -125
  371. package/src/charts/HeatmapChart.tsx +0 -155
  372. package/src/charts/LineChart.tsx +0 -247
  373. package/src/charts/PlotChart.tsx +0 -168
  374. package/src/charts/RadarChart.tsx +0 -208
  375. package/src/charts/RingChart.tsx +0 -133
  376. package/src/charts/ScatterChart.tsx +0 -223
  377. package/src/charts/WaterfallChart.tsx +0 -201
  378. package/src/charts/advanced.tsx +0 -676
  379. package/src/charts/extra.tsx +0 -242
  380. package/src/charts/index.ts +0 -86
  381. package/src/charts/scales.ts +0 -163
@@ -0,0 +1,352 @@
1
+ package expo.modules.liquidglass.glass
2
+
3
+ import expo.modules.liquidglass.enums.GlassBlurDirection
4
+ import expo.modules.liquidglass.enums.GlassVariant
5
+ import expo.modules.liquidglass.records.GlassMetalOptions
6
+ import kotlin.math.abs
7
+ import kotlin.math.ceil
8
+ import kotlin.math.cos
9
+ import kotlin.math.max
10
+ import kotlin.math.min
11
+ import kotlin.math.sin
12
+
13
+ /**
14
+ * A fully resolved appearance, in **pixels and radians**, ready to become shader uniforms.
15
+ *
16
+ * This is the Android analogue of `LiquidGlassView.applyAppearance()` (`LiquidGlassView.swift:240-274`)
17
+ * and reproduces its two documented quirks deliberately rather than fixing them on one platform:
18
+ *
19
+ * 1. `dispersion.reach` falls back to the **refraction** height default — not to a dedicated value,
20
+ * and not to a caller-supplied `refraction.height`.
21
+ * 2. `refraction.curve` is all-or-nothing; a partial object takes the Record defaults for the rest.
22
+ */
23
+ internal data class GlassAppearance(
24
+ val blurRadiusPx: Float,
25
+ val opacity: Float,
26
+ val frost: Float,
27
+ val saturation: Float,
28
+ val noise: Float,
29
+ val light: Float,
30
+ val refractionAmountPx: Float,
31
+ val refractionWidthPx: Float,
32
+ val refractionHeightPx: Float,
33
+ val refractionDepth: Float,
34
+ val refractionSwirl: Float,
35
+ val curvePower: Float,
36
+ val curveBias: Float,
37
+ val dispersionAmountPx: Float,
38
+ val dispersionReachPx: Float,
39
+ val dispersionQuadrant: Float,
40
+ val highlightIntensity: Float,
41
+ val highlightAngleRadians: Float,
42
+ val highlightWidthPx: Float,
43
+ val highlightFalloff: Float,
44
+ val borderWidthPx: Float,
45
+ val borderOpacity: Float,
46
+ val shapeXPx: Float,
47
+ val shapeYPx: Float,
48
+ val shapeWidthPx: Float,
49
+ val shapeHeightPx: Float,
50
+ val morphXPx: Float,
51
+ val morphYPx: Float,
52
+ val morphWidthPx: Float,
53
+ val morphHeightPx: Float,
54
+ val morphRadiusPx: Float,
55
+ val morphSmoothingPx: Float,
56
+ val progStartPx: Float,
57
+ val progEndPx: Float,
58
+ val progDirection: GlassBlurDirection,
59
+ val progRampStart: Float,
60
+ val progRampEnd: Float,
61
+ val innerShadowRadiusPx: Float,
62
+ val innerShadowOffsetXPx: Float,
63
+ val innerShadowOffsetYPx: Float,
64
+ val innerShadowOpacity: Float,
65
+ val magnification: Float,
66
+ val density: Float
67
+ ) {
68
+ /**
69
+ * Whether the inner shadow band draws. Neither it nor [magnification] touches the padding
70
+ * budget: the band samples nothing, and a magnification >= 1 only ever samples inward.
71
+ */
72
+ val hasInnerShadow: Boolean get() = innerShadowRadiusPx > 0.01f && innerShadowOpacity > 0.001f
73
+
74
+ /**
75
+ * Whether the blur ramp participates. Requires a real gradient to blur toward — two zero radii
76
+ * are a no-op, and equal non-zero radii are just a uniform blur spelled slower, so those take
77
+ * the single cheap hwui stage through [uniformBlurPx] instead of the pyramid.
78
+ */
79
+ val hasProgressiveBlur: Boolean
80
+ get() = max(progStartPx, progEndPx) > 0.5f && abs(progStartPx - progEndPx) > 0.5f
81
+
82
+ /**
83
+ * The radius of the uniform blur stage, px: a flat `progressiveBlur` (both radii agree) is that
84
+ * radius, otherwise `blurRadius`. A real ramp reads [hasProgressiveBlur] instead and this is
85
+ * whatever `blurRadius` says — the pyramid replaces it.
86
+ */
87
+ val uniformBlurPx: Float
88
+ get() = if (!hasProgressiveBlur && max(progStartPx, progEndPx) > 0.5f) progStartPx else blurRadiusPx
89
+
90
+ /** The largest radius any blur stage may reach, px — what the padding must budget for. */
91
+ val maxBlurPx: Float get() = max(blurRadiusPx, max(progStartPx, progEndPx))
92
+
93
+ /**
94
+ * Whether the morph partner participates. Mirrors the shader's own gate exactly, so a false
95
+ * here means the branch is off and the field untouched. Morph adds no padding: refracted taps
96
+ * move inward from the merged silhouette exactly as from the primary one, and the smooth-min
97
+ * neck only ever lives between the two shapes.
98
+ */
99
+ val hasMorph: Boolean
100
+ get() = morphSmoothingPx > 0.01f && morphWidthPx > 0f && morphHeightPx > 0f
101
+
102
+ /** Whether `metal.shape` insets the primary shape from the view. */
103
+ val hasShape: Boolean get() = shapeWidthPx > 0f && shapeHeightPx > 0f
104
+
105
+ /**
106
+ * How far a **refracted** tap can land outside the view, in pixels. Two regimes:
107
+ *
108
+ * **Along the displacement axis** — usually zero. The shader computes
109
+ * `base = pixels - amount * direction` where `direction` keeps a non-negative outward
110
+ * component for `|swirl| <= 1` (its normal term dominates; `dot(radial, normal) >= 0`
111
+ * everywhere), so a positive `amount` moves the sample inward. Only a negative `amount` flips
112
+ * it outward, which needs a negative `refraction.amount` or a negative `curve.bias` — neither
113
+ * of which any variant default produces. `amount = (profile + bias * (1 - t)) *
114
+ * refractionAmount` with `profile` and `(1 - t)` both in `[0, 1]`, so the bracket is bounded
115
+ * by `[min(0, bias), max(1, 1 + bias)]`.
116
+ *
117
+ * **Around corners, via the swirl** — the lean adds a tangential component of up to
118
+ * `|swirl|` of the unit direction, and a tangential displacement `d` can exit the shape near
119
+ * a corner of radius `r` by `sqrt(r^2 + d^2) - r`, which approaches `d` as `r -> 0`. The radii
120
+ * are not known here, so the bound charged is the r-independent worst case,
121
+ * `|swirl| * maxDisplacement` — 15 dp at `regular` defaults, and exactly zero at `swirl 0`,
122
+ * which is what keeps the Metal-parity configuration's padding unchanged.
123
+ */
124
+ val refractionReachPx: Float
125
+ get() {
126
+ val lo = min(0f, curveBias) * refractionAmountPx
127
+ val hi = max(1f, 1f + curveBias) * refractionAmountPx
128
+ val alongAxis = max(0f, -min(lo, hi))
129
+ val aroundCorners = abs(refractionSwirl) * max(0f, max(abs(lo), abs(hi)))
130
+ return alongAxis + aroundCorners
131
+ }
132
+
133
+ /**
134
+ * How far a **dispersion** tap can land outside the view, in pixels.
135
+ *
136
+ * The taps walk along `tangent`, the perpendicular of the refraction direction — *along* the
137
+ * edge rather than across it — by `(u - 0.5) * spread` with `u` in `[0, 1]`, so at most half the
138
+ * spread either way. On a straight edge that never leaves the shape; only near a corner does it
139
+ * carry a tap past the boundary, and never by more than this.
140
+ *
141
+ * `spread = circleMap(1 - dispersionT) * dispersionAmount` peaks at `dispersionAmount` on the
142
+ * boundary itself, so half of that is the bound. Not to be confused with [dispersionReachPx],
143
+ * which is the `dispersion.reach` prop — the depth over which the spread decays.
144
+ */
145
+ val dispersionOutwardReachPx: Float get() = 0.5f * abs(dispersionAmountPx)
146
+
147
+ /**
148
+ * How far the blur stage smears, in pixels — uniform or progressive, whichever reaches
149
+ * further. Zero when no blur stage runs.
150
+ */
151
+ val blurReachPx: Float
152
+ get() = if (maxBlurPx > 0.01f) max(maxBlurPx * 1.5f, 16f * density) else 0f
153
+
154
+ /**
155
+ * How far outside the view the backdrop node must extend, in pixels.
156
+ *
157
+ * iOS uses `max(refraction + dispersion, blurExtent)` (`GlassSurfaceView.swift:133-137`).
158
+ * **Android must add them instead**, and the difference is not cosmetic: on iOS the blur pass
159
+ * reads from the whole-window capture, which itself extends up to 220 pt beyond the region, and
160
+ * only *writes* the padded rect — so blur contamination never reaches the padded rect's interior.
161
+ * Here the blur's input is the padded node itself, so `TileMode.CLAMP` fabricates the outer
162
+ * ~1.5x-blur-radius ring out of edge pixels. If a refracted tap lands in that ring it reads a
163
+ * smear. Taking the max would put the refraction band exactly there.
164
+ *
165
+ * The tier matters because the reaches it has to cover differ: only the shader refracts, and only
166
+ * API 31+ blurs.
167
+ *
168
+ * Note how little the shader itself contributes — see [refractionReachPx] and
169
+ * [dispersionOutwardReachPx]. At every variant default the refraction term is **zero**, because
170
+ * the refracted sample moves inward, and the padding is the blur's alone.
171
+ */
172
+ fun backdropPaddingPx(tier: GlassTier): Int {
173
+ val reach = when (tier) {
174
+ GlassTier.FULL -> refractionReachPx + dispersionOutwardReachPx + blurReachPx
175
+ GlassTier.BLUR -> blurReachPx
176
+ // A scrim draws the backdrop untouched — it samples nothing outside the view.
177
+ GlassTier.SCRIM, GlassTier.NONE -> return 0
178
+ }
179
+ return ceil(reach + 2f * density).toInt()
180
+ }
181
+
182
+ /** Whether the uniform blur stage is worth running at all. Mirrors the iOS `radius <= 0.01` early-out. */
183
+ val hasBlur: Boolean get() = uniformBlurPx > 1f
184
+
185
+ /**
186
+ * `createBlurEffect` takes a radius, and HWUI converts it internally as
187
+ * `sigma = 0.57735 * R + 0.5`. iOS uses `sigma = 0.5 * blurRadiusPx`, so matching the two gives
188
+ * `R = (0.5 * blurRadiusPx - 0.5) / 0.57735`.
189
+ */
190
+ val hwuiBlurRadius: Float get() = hwuiRadius(uniformBlurPx)
191
+
192
+ /** The same iOS-sigma-to-hwui-radius conversion for an arbitrary radius in px. */
193
+ fun hwuiRadius(px: Float): Float = (0.5f * px - 0.5f) / 0.57735f
194
+
195
+ /**
196
+ * What the API 31–32 tier should blur at: a progressive ramp collapses to its mean — the only
197
+ * honest uniform stand-in — and otherwise the plain radius. The shader tier never reads this.
198
+ */
199
+ val fallbackBlurPx: Float
200
+ get() = if (hasProgressiveBlur) (progStartPx + progEndPx) * 0.5f else uniformBlurPx
201
+
202
+ /**
203
+ * `(cos angle, sin angle)`, so the shader's angular highlight costs no transcendentals per pixel.
204
+ *
205
+ * Metal computes `sin(atan2(n.y, n.x) - highlightAngle)`; expanding by the sine difference
206
+ * identity gives `n.y * cos - n.x * sin`, which is exact.
207
+ */
208
+ val highlightCos: Float get() = cos(highlightAngleRadians)
209
+ val highlightSin: Float get() = sin(highlightAngleRadians)
210
+
211
+ companion object {
212
+ fun resolve(
213
+ variant: GlassVariant,
214
+ metal: GlassMetalOptions?,
215
+ density: Float
216
+ ): GlassAppearance {
217
+ val defaults = variant.metalDefaults
218
+ val refraction = metal?.refraction
219
+ val dispersion = metal?.dispersion
220
+ val highlight = metal?.highlight
221
+ val border = metal?.border
222
+ val morph = metal?.morph
223
+ val shape = metal?.shape
224
+ val progressive = metal?.progressiveBlur
225
+ val innerShadow = metal?.innerShadow
226
+ val curve = refraction?.curve
227
+
228
+ fun dp(override: Double?, fallback: Float): Float =
229
+ (override?.toFloat() ?: fallback) * density
230
+
231
+ fun scalar(override: Double?, fallback: Float): Float =
232
+ override?.toFloat() ?: fallback
233
+
234
+ return GlassAppearance(
235
+ blurRadiusPx = dp(metal?.blurRadius, defaults.blurRadius),
236
+ // Not variant-driven, and deliberately unclamped, matching LiquidGlassView.swift:269.
237
+ opacity = scalar(metal?.opacity, 1f),
238
+ frost = scalar(metal?.frost, defaults.frost),
239
+ // Unclamped: the iOS demo passes -5 and iOS does not object.
240
+ saturation = scalar(metal?.saturation, defaults.saturation),
241
+ noise = scalar(metal?.noise, defaults.noise),
242
+ light = scalar(metal?.light, defaults.light),
243
+ refractionAmountPx = dp(refraction?.amount, defaults.refractionAmount),
244
+ refractionWidthPx = dp(refraction?.width, defaults.refractionWidth),
245
+ refractionHeightPx = dp(refraction?.height, defaults.refractionHeight),
246
+ refractionDepth = scalar(refraction?.depth, defaults.refractionDepth),
247
+ // Android-only field (iOS drops the key), unitless like `depth`; not variant-driven.
248
+ // Clamped: [refractionReachPx]'s outward-excursion bound needs |swirl| <= 1, so unlike
249
+ // `saturation` this one is not free to run wild.
250
+ refractionSwirl =
251
+ scalar(refraction?.swirl, DEFAULT_REFRACTION_SWIRL).coerceIn(-1f, 1f),
252
+ // All-or-nothing, quirk (2) above.
253
+ curvePower = if (curve != null) curve.power.toFloat() else defaults.curvePower,
254
+ curveBias = if (curve != null) curve.bias.toFloat() else defaults.curveBias,
255
+ dispersionAmountPx = dp(dispersion?.amount, defaults.dispersionAmount),
256
+ // Quirk (1): the fallback is the *refraction* height default.
257
+ dispersionReachPx = dp(dispersion?.reach, defaults.refractionHeight),
258
+ // Android-only, not variant-driven; 0 is the iOS-parity even rim. Clamped because the
259
+ // shader's `mix(1, q, t)` is only a blend between "even" and "quadrant" for t in [0, 1] —
260
+ // outside it the weight can exceed 1 and overrun the padding budget.
261
+ dispersionQuadrant =
262
+ scalar(dispersion?.quadrant, DEFAULT_DISPERSION_QUADRANT).coerceIn(0f, 1f),
263
+ highlightIntensity = scalar(highlight?.intensity, defaults.highlightIntensity),
264
+ // Not variant-driven; hard `?? 135`, degrees in, radians out.
265
+ highlightAngleRadians =
266
+ Math.toRadians(highlight?.angle ?: DEFAULT_HIGHLIGHT_ANGLE_DEGREES).toFloat(),
267
+ // Android-only field (the iOS Record has no `width`, so the key is dropped there), for an
268
+ // Android-only remodel: the depth of the glass border light. Not variant-driven.
269
+ highlightWidthPx = dp(highlight?.width, DEFAULT_HIGHLIGHT_WIDTH_DP),
270
+ // Android-only. Floored here, not per-pixel: pow(0, 0) in the shader is the alternative.
271
+ highlightFalloff =
272
+ scalar(highlight?.falloff, DEFAULT_HIGHLIGHT_FALLOFF).coerceAtLeast(0.01f),
273
+ // Not variant-driven; hard `?? 1`. A width of 0 hides the border entirely.
274
+ borderWidthPx = dp(border?.width, 1f),
275
+ borderOpacity = scalar(border?.opacity, defaults.borderOpacity),
276
+ // Not variant-driven — no variant ships a shape inset or a partner; absent means off.
277
+ shapeXPx = dp(shape?.x, 0f),
278
+ shapeYPx = dp(shape?.y, 0f),
279
+ shapeWidthPx = dp(shape?.width, 0f),
280
+ shapeHeightPx = dp(shape?.height, 0f),
281
+ morphXPx = dp(morph?.x, 0f),
282
+ morphYPx = dp(morph?.y, 0f),
283
+ morphWidthPx = dp(morph?.width, 0f),
284
+ morphHeightPx = dp(morph?.height, 0f),
285
+ morphRadiusPx = dp(morph?.cornerRadius, 0f),
286
+ morphSmoothingPx = dp(morph?.smoothing, 0f),
287
+ progStartPx = dp(progressive?.startRadius, 0f),
288
+ progEndPx = dp(progressive?.endRadius, 0f),
289
+ progDirection = progressive?.direction ?: GlassBlurDirection.down,
290
+ // The window is clamped into a well-ordered pair so the shader's inverse-length uniform
291
+ // can never divide by zero or run the ramp backwards.
292
+ progRampStart = scalar(progressive?.start, 0f).coerceIn(0f, 1f),
293
+ progRampEnd = run {
294
+ val s = scalar(progressive?.start, 0f).coerceIn(0f, 1f)
295
+ max(scalar(progressive?.end, 1f).coerceIn(0f, 1f), s + 1e-3f)
296
+ },
297
+ // The cast defaults to straight down by one radius (Kyant's `InnerShadow` default).
298
+ innerShadowRadiusPx = dp(innerShadow?.radius, 0f).coerceAtLeast(0f),
299
+ innerShadowOffsetXPx = dp(innerShadow?.offsetX, 0f),
300
+ innerShadowOffsetYPx = innerShadow?.offsetY?.let { (it.toFloat() * density) }
301
+ ?: dp(innerShadow?.radius, 0f).coerceAtLeast(0f),
302
+ innerShadowOpacity = scalar(innerShadow?.opacity, DEFAULT_INNER_SHADOW_OPACITY).coerceIn(0f, 1f),
303
+ // Clamped to [1, 4]: below 1 samples outside the padded node, and the ceiling is taste.
304
+ magnification = scalar(metal?.magnification, 1f).coerceIn(1f, 4f),
305
+ density = density
306
+ )
307
+ }
308
+
309
+ /**
310
+ * 180 puts the lobe axis vertical: top and bottom edges lit, side rims fading to zero at the
311
+ * midpoints. Measured off real iOS 26 (research/04): the dark-mode bars are perfectly
312
+ * top/bottom symmetric with dead side extremes, and the icon's axis is within ~15 degrees of
313
+ * vertical. The old 135 (top-left lobe) matched this project's Metal fallback, not Apple.
314
+ */
315
+ private const val DEFAULT_HIGHLIGHT_ANGLE_DEGREES = 180.0
316
+
317
+ /**
318
+ * The crisp line's depth. Shipped at 5 dp, then 3.5 (PLAN F35), then 1.5 (F48); pixel
319
+ * measurement of real iOS 26 (research/04, C10) puts Apple's line at 2-3px on a 238px icon —
320
+ * ~0.5-0.75 dp. The faint wide glow under the lit edges is not this line's job anymore; it is
321
+ * the separate sheen band in the HIGHLIGHT fragment.
322
+ */
323
+ private const val DEFAULT_HIGHLIGHT_WIDTH_DP = 0.75f
324
+
325
+ /**
326
+ * Kyant's `falloff` default. 1 keeps the lobes broad; the thin band, not the exponent, is
327
+ * what keeps the line crisp. Real iOS 26 bars measure at falloff ~1 (research/04, C2).
328
+ */
329
+ private const val DEFAULT_HIGHLIGHT_FALLOFF = 1f
330
+
331
+ /**
332
+ * How far the refraction direction leans toward the light axis before normalization. Default
333
+ * 0 — dead. Shipped one round at 0.25 on the theory that the highlight angle steers the
334
+ * "swirl" seen on real iOS 26; per-edge pixel solves of an actual icon falsified it
335
+ * (research/04, C8: no constant-axis lean fits all four edges, and +0.25 is the worse fit on
336
+ * three of them). The twist the eye sees is `depthEffect`'s radial term sweeping through the
337
+ * corners. The knob stays for taste; the default tells the truth.
338
+ */
339
+ private const val DEFAULT_REFRACTION_SWIRL = 0f
340
+
341
+ /**
342
+ * 0 — the fringe rings the whole rim evenly, which is what the Metal source does and therefore
343
+ * what this port has always done. Kyant's corner-weighted alternative is a deliberate opt-in
344
+ * (`dispersion.quadrant`) rather than a new default, because the two look genuinely different
345
+ * and every existing caller tuned their amount against this one.
346
+ */
347
+ private const val DEFAULT_DISPERSION_QUADRANT = 0f
348
+
349
+ /** Kyant's `InnerShadow` default colour: black at 15 %. */
350
+ private const val DEFAULT_INNER_SHADOW_OPACITY = 0.15f
351
+ }
352
+ }
@@ -0,0 +1,109 @@
1
+ package expo.modules.liquidglass.glass
2
+
3
+ import android.content.Context
4
+ import android.content.pm.ApplicationInfo
5
+ import android.util.Log
6
+ import expo.modules.liquidglass.LOG_TAG
7
+
8
+ /**
9
+ * Diagnostics, off by default. Toggle from JS with `ExpoLiquidGlassModule.setDebugLogging(true)`.
10
+ *
11
+ * The frame counters are the instrument for the two questions this port cannot answer from
12
+ * documentation: whether the backdrop stays current without an explicit invalidate, and whether
13
+ * notifying consumers from a draw pass feeds back into an invalidation loop. At rest both counters
14
+ * must stop moving.
15
+ */
16
+ internal object GlassDebug {
17
+ @Volatile
18
+ var enabled: Boolean = false
19
+
20
+ /**
21
+ * True when the host app is debuggable.
22
+ *
23
+ * Gates the correctness warnings in [GlassEnvironment], which fire without anyone asking for
24
+ * them — every mistake they catch renders as "the glass just doesn't work", so waiting for a
25
+ * developer to opt in would defeat the point. They stay out of release builds.
26
+ *
27
+ * Resolved from a **view's** context rather than at module init: `AppContext.reactContext` is
28
+ * still null when `OnCreate` runs, so reading it there silently left this false and disabled
29
+ * every check.
30
+ */
31
+ @Volatile
32
+ var devMode: Boolean = false
33
+ private set
34
+
35
+ @Volatile
36
+ private var devModeResolved = false
37
+
38
+ fun resolveDevMode(context: Context) {
39
+ if (devModeResolved) return
40
+ devModeResolved = true
41
+ devMode = (context.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE) != 0
42
+ }
43
+
44
+ private val warned = java.util.Collections.newSetFromMap(
45
+ java.util.concurrent.ConcurrentHashMap<String, Boolean>()
46
+ )
47
+
48
+ private var providerRecordings = 0L
49
+ private var glassDraws = 0L
50
+ private var lastReportMs = 0L
51
+
52
+ fun onProviderRecorded() {
53
+ if (!enabled) return
54
+ providerRecordings++
55
+ report()
56
+ }
57
+
58
+ fun onGlassDrawn() {
59
+ if (!enabled) return
60
+ glassDraws++
61
+ report()
62
+ }
63
+
64
+ fun log(message: String) {
65
+ if (enabled) Log.d(LOG_TAG, message)
66
+ }
67
+
68
+ /**
69
+ * Logs [message] at most once per [key] for the life of the process.
70
+ *
71
+ * The conditions these describe are per-frame, so an ungated warning would produce thousands of
72
+ * identical lines and bury itself.
73
+ */
74
+ fun warnOnce(key: String, message: String) {
75
+ if (!devMode && !enabled) return
76
+ if (!warned.add(key)) return
77
+ Log.w(LOG_TAG, message)
78
+ }
79
+
80
+ /**
81
+ * [warnOnce] at INFO, for topologies that are supported but worth a line in the log — stacked
82
+ * glass being the one so far. Same gating, same once-per-process dedupe.
83
+ */
84
+ fun infoOnce(key: String, message: String) {
85
+ if (!devMode && !enabled) return
86
+ if (!warned.add(key)) return
87
+ Log.i(LOG_TAG, message)
88
+ }
89
+
90
+ private fun report() {
91
+ val now = System.currentTimeMillis()
92
+ if (lastReportMs == 0L) {
93
+ lastReportMs = now
94
+ return
95
+ }
96
+ if (now - lastReportMs < REPORT_INTERVAL_MS) return
97
+ val seconds = (now - lastReportMs) / 1000.0
98
+ Log.d(
99
+ LOG_TAG,
100
+ "frames/s — provider recordings: %.1f, glass draws: %.1f"
101
+ .format(providerRecordings / seconds, glassDraws / seconds)
102
+ )
103
+ providerRecordings = 0
104
+ glassDraws = 0
105
+ lastReportMs = now
106
+ }
107
+
108
+ private const val REPORT_INTERVAL_MS = 1000L
109
+ }
@@ -0,0 +1,139 @@
1
+ package expo.modules.liquidglass.glass
2
+
3
+ import android.os.Build
4
+ import android.view.SurfaceView
5
+ import android.view.View
6
+ import android.view.ViewGroup
7
+ import expo.modules.liquidglass.LiquidGlassProviderView
8
+
9
+ /**
10
+ * Dev-mode checks for the mistakes this architecture makes possible.
11
+ *
12
+ * Android's provider is a required wrapper that iOS does not need, and every failure below renders
13
+ * as "the glass just doesn't work" rather than as an error. Each check runs once per view, after
14
+ * layout, and only when the app is debuggable — see [GlassDebug.devMode].
15
+ */
16
+ internal object GlassEnvironment {
17
+
18
+ /**
19
+ * Runs on a glass view once it is attached and laid out.
20
+ *
21
+ * Deliberately *not* run at attach time: `canScrollVertically` needs the container's children
22
+ * measured before it can answer, and a provider mounted in the same commit may not have been
23
+ * added to the hierarchy yet.
24
+ */
25
+ fun checkGlassView(glass: View, providerId: String) {
26
+ GlassDebug.resolveDevMode(glass.context)
27
+ if (!GlassDebug.devMode) return
28
+ checkNotInsideProvider(glass, providerId)
29
+ checkOverscrollAncestors(glass)
30
+ }
31
+
32
+ /**
33
+ * **R10.** A glass view inside a provider's subtree is part of that provider's recording, so its
34
+ * finished glass becomes part of the backdrop every view reading that provider sees.
35
+ *
36
+ * With **different** ids that is the *stacked glass* topology (the `stack` example screen; README
37
+ * "Stacked glass"): the re-refraction is the point, so it is reported once at INFO — the log
38
+ * documents the topology without crying wolf.
39
+ *
40
+ * The **matching**-id case used to be a warning here. It is not a diagnostic at all: it is a
41
+ * cycle in the render tree and it kills the process, so it belongs to [BackdropGraph], which
42
+ * blocks it on the draw path in every build rather than describing it in debug ones. This check
43
+ * would also have missed it whenever the ids differ but a listed `providerIds` id matches, and
44
+ * whenever the loop runs through a second provider — [BackdropGraph] catches both.
45
+ */
46
+ private fun checkNotInsideProvider(glass: View, providerId: String) {
47
+ var parent = glass.parent
48
+ while (parent is View) {
49
+ if (parent is LiquidGlassProviderView) {
50
+ if (parent.providerId != providerId) {
51
+ GlassDebug.infoOnce(
52
+ "inside-provider:$providerId:false",
53
+ "Stacked glass: a <LiquidGlassView providerId=\"$providerId\"> renders inside a " +
54
+ "<LiquidGlassProvider providerId=\"${parent.providerId}\">, so its finished glass " +
55
+ "is part of \"${parent.providerId}\"'s backdrop and glass reading that provider " +
56
+ "re-refracts it. If stacking is not intended, move this view outside the provider."
57
+ )
58
+ }
59
+ return
60
+ }
61
+ parent = parent.parent
62
+ }
63
+ }
64
+
65
+ /**
66
+ * **R11.** Android 12+ draws overscroll as a stretch, and the stretch is a pixel-space
67
+ * `RenderEffect` on the scrolling container's `RenderNode` — not a view transform.
68
+ *
69
+ * Glass inside that container is warped along with the backdrop already baked into it, while the
70
+ * provider is a sibling subtree and stays flat, so the two disagree for as long as the overscroll
71
+ * is held. Nothing here can compensate: the effect is invisible to `getLocationInWindow`,
72
+ * `View.getMatrix()` and our own transform walk, and no public API exposes the stretch amount —
73
+ * `EdgeEffect.getDistance()` is API 31+, but `ScrollView` and `RecyclerView` keep their
74
+ * `EdgeEffect` instances private.
75
+ */
76
+ private fun checkOverscrollAncestors(glass: View) {
77
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) return
78
+ var parent = glass.parent
79
+ while (parent is View) {
80
+ val view = parent as View
81
+ if (view.overScrollMode != View.OVER_SCROLL_NEVER && isScrollable(view)) {
82
+ GlassDebug.warnOnce(
83
+ "overscroll:${view.javaClass.simpleName}",
84
+ "A <LiquidGlassView> is inside a scrolling ${view.javaClass.simpleName} with stretch " +
85
+ "overscroll enabled. While the list is overscrolled the glass and its backdrop are " +
86
+ "warped together but the provider behind them is not, so they visibly disagree. Set " +
87
+ "overScrollMode=\"never\" on that list."
88
+ )
89
+ return
90
+ }
91
+ parent = view.parent
92
+ }
93
+ }
94
+
95
+ private fun isScrollable(view: View): Boolean =
96
+ view.isScrollContainer ||
97
+ view.canScrollVertically(1) ||
98
+ view.canScrollVertically(-1) ||
99
+ view.canScrollHorizontally(1) ||
100
+ view.canScrollHorizontally(-1)
101
+
102
+ /**
103
+ * **R7 / D4.** `SurfaceView` composites out of process, so no `Canvas` or `RenderNode` path can
104
+ * see it — it is a hole in every backdrop we record. `TextureView` *is* capturable by a hardware
105
+ * `RecordingCanvas`, which is why TextureView-backed playback is the documented requirement for
106
+ * video behind glass.
107
+ *
108
+ * Re-run from the provider's own recording pass rather than once at attach: a `SurfaceView`
109
+ * almost never exists when the provider first attaches. It arrives when the video mounts, which
110
+ * for anything data-driven is later — and a one-shot scan misses it entirely. The provider only
111
+ * re-records on a structural change, which is exactly when a new one can appear, so the scan is
112
+ * both cheap and correctly timed.
113
+ *
114
+ * @return true when there is nothing to be gained by scanning again — either a `SurfaceView` was
115
+ * found and reported, or this is not a debuggable build.
116
+ */
117
+ fun checkProviderSubtree(provider: ViewGroup): Boolean {
118
+ GlassDebug.resolveDevMode(provider.context)
119
+ if (!GlassDebug.devMode) return true
120
+ val found = findSurfaceView(provider) ?: return false
121
+ GlassDebug.warnOnce(
122
+ "surfaceview:${found.javaClass.name}",
123
+ "A ${found.javaClass.simpleName} (a SurfaceView) is inside a <LiquidGlassProvider>. " +
124
+ "SurfaceView composites out of process and cannot be captured by any Canvas or " +
125
+ "RenderNode path, so it will be a hole in the backdrop. For video, use TextureView-backed " +
126
+ "playback — expo-video accepts surfaceType=\"textureView\"."
127
+ )
128
+ return true
129
+ }
130
+
131
+ private fun findSurfaceView(view: View): View? {
132
+ if (view is SurfaceView) return view
133
+ if (view !is ViewGroup) return null
134
+ for (i in 0 until view.childCount) {
135
+ findSurfaceView(view.getChildAt(i))?.let { return it }
136
+ }
137
+ return null
138
+ }
139
+ }
@@ -0,0 +1,85 @@
1
+ package expo.modules.liquidglass.glass
2
+
3
+ import android.app.Activity
4
+ import android.content.pm.ActivityInfo
5
+ import android.os.Build
6
+ import android.view.Display
7
+ import java.util.concurrent.CopyOnWriteArraySet
8
+
9
+ /**
10
+ * The process-wide HDR opt-in.
11
+ *
12
+ * HDR here means one thing: the glass border light may exceed SDR white (the shader's
13
+ * `hdrHeadroom` uniform). That needs the *window* in `COLOR_MODE_HDR` — an FP16, extended-sRGB
14
+ * surface — which is a window-level decision with a real cost (double the buffer bandwidth for
15
+ * the whole UI), so it is **opt-in via `ExpoLiquidGlass.setHdrEnabled(true)` and never
16
+ * automatic**. Mixed HDR/SDR UI composition exists from API 34; below that this object is inert.
17
+ *
18
+ * The request is stored process-wide and re-applied on every activity-foreground
19
+ * (`OnActivityEntersForeground` in the module), so it survives activity recreation — rotation,
20
+ * theme change — without the app having to call again.
21
+ *
22
+ * Glass views subscribe via [addListener] to re-resolve their headroom when the request flips at
23
+ * runtime; the per-frame brightness-driven ratio changes reach them through
24
+ * `Display.registerHdrSdrRatioChangedListener` instead (see LiquidGlassView), which is
25
+ * per-display and only registered while HDR is requested.
26
+ */
27
+ internal object GlassHdr {
28
+
29
+ fun interface Listener {
30
+ fun onHdrStateChanged()
31
+ }
32
+
33
+ /** Whether the app has asked for HDR. Applied to the window only on API 34+. */
34
+ @Volatile
35
+ var requested: Boolean = false
36
+ private set
37
+
38
+ private val listeners = CopyOnWriteArraySet<Listener>()
39
+
40
+ fun addListener(listener: Listener) {
41
+ listeners.add(listener)
42
+ }
43
+
44
+ fun removeListener(listener: Listener) {
45
+ listeners.remove(listener)
46
+ }
47
+
48
+ /** Main thread. Stores the request, applies it to the window, notifies glass views. */
49
+ fun setRequested(enabled: Boolean, activity: Activity?) {
50
+ val changed = requested != enabled
51
+ requested = enabled
52
+ apply(activity)
53
+ if (changed) {
54
+ for (listener in listeners) listener.onHdrStateChanged()
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Main thread. Re-applies the stored request to the (possibly new) window. Idempotent — the
60
+ * mode is only written when it differs, because setting `colorMode` re-allocates the surface.
61
+ */
62
+ fun apply(activity: Activity?) {
63
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) return
64
+ val window = activity?.window ?: return
65
+ val mode =
66
+ if (requested) ActivityInfo.COLOR_MODE_HDR else ActivityInfo.COLOR_MODE_DEFAULT
67
+ if (window.colorMode != mode) window.colorMode = mode
68
+ }
69
+
70
+ /** Whether this display can report an HDR/SDR ratio at all (panel + platform support). */
71
+ fun isSupported(display: Display?): Boolean =
72
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE &&
73
+ display != null &&
74
+ display.isHdrSdrRatioAvailable
75
+
76
+ /**
77
+ * The headroom the shader may use *right now*: the display's live HDR/SDR ratio when HDR is
78
+ * requested and supported, else exactly 1 — which makes the shader bit-identical to SDR.
79
+ */
80
+ fun currentHeadroom(display: Display?): Float {
81
+ if (!requested) return 1f
82
+ if (!isSupported(display)) return 1f
83
+ return display!!.hdrSdrRatio.coerceAtLeast(1f)
84
+ }
85
+ }