@luckylca/react-native-liquid-glass 0.0.0-stage → 0.2.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 (674) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +307 -2
  3. package/README.zh-CN.md +310 -0
  4. package/THIRD_PARTY_NOTICES.md +98 -0
  5. package/android/build.gradle +19 -0
  6. package/android/src/main/AndroidManifest.xml +1 -0
  7. package/android/src/main/java/expo/modules/localglass/ExpoLocalGlassEngineModule.kt +141 -0
  8. package/android/src/main/java/expo/modules/localglass/ExpoLocalGlassModule.kt +341 -0
  9. package/android/src/main/java/expo/modules/localglass/LocalGlassShader.kt +59 -0
  10. package/android/src/main/java/expo/modules/newhuliquidglass/CoreLiquidGlassRegistry.kt +75 -0
  11. package/android/src/main/java/expo/modules/newhuliquidglass/EffectiveScrollInputBridge.kt +47 -0
  12. package/android/src/main/java/expo/modules/newhuliquidglass/ExpoGlassCoreModule.kt +226 -0
  13. package/android/src/main/java/expo/modules/newhuliquidglass/ExpoGlassProviderCoreView.kt +1125 -0
  14. package/android/src/main/java/expo/modules/newhuliquidglass/ExpoGlassSurfaceCoreView.kt +571 -0
  15. package/android/src/main/java/expo/modules/newhuliquidglass/PassSurfaceSuppression.kt +39 -0
  16. package/android/src/main/java/expo/modules/newhuliquidglass/SharedGlassPassProbeLog.kt +23 -0
  17. package/android/src/main/java/expo/modules/newhuliquidglass/SharedGlassPassWiring.kt +59 -0
  18. package/android-core/build.gradle +36 -0
  19. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/BackdropRecorder.kt +930 -0
  20. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/FrozenBackdrop.kt +66 -0
  21. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassBackdropCoordinator.kt +624 -0
  22. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassBackdropSourceHandle.kt +8 -0
  23. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassScrollSource.kt +13 -0
  24. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassViewController.kt +1605 -0
  25. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/LiquidGlassProviderLayout.kt +340 -0
  26. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/LiquidGlassView.kt +103 -0
  27. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/ReferenceSourceWindowPolicy.kt +13 -0
  28. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/StableSceneTexturePolicy.kt +43 -0
  29. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/internal/GlassViewRenderer.kt +1459 -0
  30. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/internal/ReferenceTabSampling.kt +15 -0
  31. package/android-core/src/main/java/com/newhu/liquidglass/backdrop/internal/SharedSceneCapture.kt +163 -0
  32. package/android-core/src/main/java/com/newhu/liquidglass/core/GlassCapabilities.kt +21 -0
  33. package/android-core/src/main/java/com/newhu/liquidglass/core/GlassEngine.kt +131 -0
  34. package/android-core/src/main/java/com/newhu/liquidglass/core/GlassMaterial.kt +89 -0
  35. package/android-core/src/main/java/com/newhu/liquidglass/core/GlassMath.kt +131 -0
  36. package/android-core/src/main/java/com/newhu/liquidglass/core/GlassOpticalInsets.kt +8 -0
  37. package/android-core/src/main/java/com/newhu/liquidglass/core/GlassRenderTier.kt +54 -0
  38. package/android-core/src/main/java/com/newhu/liquidglass/core/GlassShapePacker.kt +77 -0
  39. package/android-core/src/main/java/com/newhu/liquidglass/core/GlassSurfaceState.kt +11 -0
  40. package/android-core/src/main/java/com/newhu/liquidglass/core/GlassUniforms.kt +113 -0
  41. package/android-core/src/main/java/com/newhu/liquidglass/core/LiquidGlassShaders.kt +234 -0
  42. package/android-core/src/main/java/com/newhu/liquidglass/core/SharedGlassPass.kt +456 -0
  43. package/android-core/src/main/java/com/newhu/liquidglass/core/geometry/G2RoundedRectangle.kt +207 -0
  44. package/android-core/src/main/java/com/newhu/liquidglass/core/geometry/ReferenceG2MaskTexture.kt +334 -0
  45. package/android-core/src/main/java/com/newhu/liquidglass/core/shader/HeightFieldGlassShader.kt +7 -0
  46. package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceBackdropBlurShader.kt +58 -0
  47. package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceGaussianDiscBackdropBlur.kt +42 -0
  48. package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceGlassUniforms.kt +111 -0
  49. package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceParityGlassShader.kt +613 -0
  50. package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceParityMultiShapeShader.kt +128 -0
  51. package/android-core/src/main/java/com/newhu/liquidglass/core/shader/SdfScaleLensShader.kt +144 -0
  52. package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassHardwareLayerExperiment.kt +29 -0
  53. package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassMaterial.kt +14 -0
  54. package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassRenderer.kt +126 -0
  55. package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassRuntimeShader.kt +50 -0
  56. package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassShader.kt +59 -0
  57. package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassView.kt +47 -0
  58. package/android-core/src/main/java/com/newhu/liquidglass/motion/GlassMotionDriver.kt +824 -0
  59. package/android-core/src/main/java/com/newhu/liquidglass/motion/GlassMotionState.kt +359 -0
  60. package/android-core/src/main/java/com/newhu/liquidglass/motion/PointerVelocityTracker.kt +109 -0
  61. package/android-core/src/main/java/com/newhu/liquidglass/motion/SpringSpec.kt +209 -0
  62. package/android-core/src/main/java/com/newhu/liquidglass/optics/G2Corner.kt +194 -0
  63. package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassMaterial.kt +250 -0
  64. package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassOpticsShader.kt +696 -0
  65. package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassParityProbe.kt +342 -0
  66. package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassShapeGeometry.kt +317 -0
  67. package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassUniformBinder.kt +308 -0
  68. package/android-core/src/main/java/com/newhu/liquidglass/optics/PixelDiff.kt +363 -0
  69. package/android-core/src/main/java/com/newhu/liquidglass/optics/ReferenceOptics.kt +568 -0
  70. package/android-core/src/main/java/com/newhu/liquidglass/rendering/GlassEngineSelection.kt +30 -0
  71. package/android-core/src/main/java/com/newhu/liquidglass/rendering/GlassSurfaceHost.kt +317 -0
  72. package/android-core/src/main/java/com/newhu/liquidglass/rendering/GlassSurfaceRenderer.kt +847 -0
  73. package/android-core/src/main/java/com/newhu/liquidglass/rendering/RetainedBackdropLayer.kt +83 -0
  74. package/android-core/src/main/java/com/newhu/liquidglass/scheduler/GlassFrameScheduler.kt +27 -0
  75. package/android-core/src/main/java/com/newhu/liquidglass/telemetry/EffectiveScrollFpsProbe.kt +965 -0
  76. package/android-core/src/main/java/com/newhu/liquidglass/telemetry/GlassTelemetry.kt +16 -0
  77. package/android-core/src/main/java/com/newhu/liquidglass/telemetry/LiquidGlassPerfTelemetry.kt +676 -0
  78. package/android-core/src/main/java/com/newhu/liquidglass/telemetry/LiquidGlassTrace.kt +30 -0
  79. package/android-core/src/main/java/com/newhu/liquidglass/telemetry/LocalGlassTelemetry.kt +55 -0
  80. package/app.plugin.js +25 -0
  81. package/docs/images/buttons.webp +0 -0
  82. package/docs/images/controls.webp +0 -0
  83. package/docs/images/tabs.webp +0 -0
  84. package/docs/publishing.md +84 -0
  85. package/expo-module.config.json +10 -0
  86. package/lib/commonjs/GlassSurface.js +832 -0
  87. package/lib/commonjs/GlassSurface.js.map +1 -0
  88. package/lib/commonjs/GlassTabBar.js +976 -0
  89. package/lib/commonjs/GlassTabBar.js.map +1 -0
  90. package/lib/commonjs/GlassTabLens.js +67 -0
  91. package/lib/commonjs/GlassTabLens.js.map +1 -0
  92. package/lib/commonjs/LiquidGlassProvider.js +40 -0
  93. package/lib/commonjs/LiquidGlassProvider.js.map +1 -0
  94. package/lib/commonjs/LocalGlassMaterial.js +194 -0
  95. package/lib/commonjs/LocalGlassMaterial.js.map +1 -0
  96. package/lib/commonjs/adaptiveLuminance.js +14 -0
  97. package/lib/commonjs/adaptiveLuminance.js.map +1 -0
  98. package/lib/commonjs/badgePalette.js +46 -0
  99. package/lib/commonjs/badgePalette.js.map +1 -0
  100. package/lib/commonjs/buttonGesturePolicy.js +22 -0
  101. package/lib/commonjs/buttonGesturePolicy.js.map +1 -0
  102. package/lib/commonjs/components/AdaptiveLuminance.js +20 -0
  103. package/lib/commonjs/components/AdaptiveLuminance.js.map +1 -0
  104. package/lib/commonjs/components/BottomSheet.js +222 -0
  105. package/lib/commonjs/components/BottomSheet.js.map +1 -0
  106. package/lib/commonjs/components/Button.js +20 -0
  107. package/lib/commonjs/components/Button.js.map +1 -0
  108. package/lib/commonjs/components/Card.js +206 -0
  109. package/lib/commonjs/components/Card.js.map +1 -0
  110. package/lib/commonjs/components/Checkbox.js +123 -0
  111. package/lib/commonjs/components/Checkbox.js.map +1 -0
  112. package/lib/commonjs/components/ControlPressContext.js +8 -0
  113. package/lib/commonjs/components/ControlPressContext.js.map +1 -0
  114. package/lib/commonjs/components/Dialog.js +122 -0
  115. package/lib/commonjs/components/Dialog.js.map +1 -0
  116. package/lib/commonjs/components/DialogAction.js +124 -0
  117. package/lib/commonjs/components/DialogAction.js.map +1 -0
  118. package/lib/commonjs/components/DialogContent.js +23 -0
  119. package/lib/commonjs/components/DialogContent.js.map +1 -0
  120. package/lib/commonjs/components/GlassButton.js +96 -0
  121. package/lib/commonjs/components/GlassButton.js.map +1 -0
  122. package/lib/commonjs/components/GlassFab.js +43 -0
  123. package/lib/commonjs/components/GlassFab.js.map +1 -0
  124. package/lib/commonjs/components/GlassMagnifier.js +135 -0
  125. package/lib/commonjs/components/GlassMagnifier.js.map +1 -0
  126. package/lib/commonjs/components/GlassPlayground.js +158 -0
  127. package/lib/commonjs/components/GlassPlayground.js.map +1 -0
  128. package/lib/commonjs/components/GlassSlider.js +364 -0
  129. package/lib/commonjs/components/GlassSlider.js.map +1 -0
  130. package/lib/commonjs/components/GlassSwitch.js +334 -0
  131. package/lib/commonjs/components/GlassSwitch.js.map +1 -0
  132. package/lib/commonjs/components/GlassTabBar.js +387 -0
  133. package/lib/commonjs/components/GlassTabBar.js.map +1 -0
  134. package/lib/commonjs/components/Input.js +180 -0
  135. package/lib/commonjs/components/Input.js.map +1 -0
  136. package/lib/commonjs/components/ListRow.js +64 -0
  137. package/lib/commonjs/components/ListRow.js.map +1 -0
  138. package/lib/commonjs/components/Menu.js +214 -0
  139. package/lib/commonjs/components/Menu.js.map +1 -0
  140. package/lib/commonjs/components/NavigationBar.js +20 -0
  141. package/lib/commonjs/components/NavigationBar.js.map +1 -0
  142. package/lib/commonjs/components/NumberWheel.js +273 -0
  143. package/lib/commonjs/components/NumberWheel.js.map +1 -0
  144. package/lib/commonjs/components/PageFeedList.js +25 -0
  145. package/lib/commonjs/components/PageFeedList.js.map +1 -0
  146. package/lib/commonjs/components/PageScaffold.js +161 -0
  147. package/lib/commonjs/components/PageScaffold.js.map +1 -0
  148. package/lib/commonjs/components/PreferenceGroup.js +34 -0
  149. package/lib/commonjs/components/PreferenceGroup.js.map +1 -0
  150. package/lib/commonjs/components/ProgressIndicator.js +79 -0
  151. package/lib/commonjs/components/ProgressIndicator.js.map +1 -0
  152. package/lib/commonjs/components/ProgressiveBlur.js +29 -0
  153. package/lib/commonjs/components/ProgressiveBlur.js.map +1 -0
  154. package/lib/commonjs/components/ReferenceSlider.js +304 -0
  155. package/lib/commonjs/components/ReferenceSlider.js.map +1 -0
  156. package/lib/commonjs/components/ReferenceTabBar.js +381 -0
  157. package/lib/commonjs/components/ReferenceTabBar.js.map +1 -0
  158. package/lib/commonjs/components/SearchBar.js +200 -0
  159. package/lib/commonjs/components/SearchBar.js.map +1 -0
  160. package/lib/commonjs/components/SegmentedControl.js +62 -0
  161. package/lib/commonjs/components/SegmentedControl.js.map +1 -0
  162. package/lib/commonjs/components/Slider.js +12 -0
  163. package/lib/commonjs/components/Slider.js.map +1 -0
  164. package/lib/commonjs/components/Snackbar.js +11 -0
  165. package/lib/commonjs/components/Snackbar.js.map +1 -0
  166. package/lib/commonjs/components/SurfaceEnvironmentContext.js +35 -0
  167. package/lib/commonjs/components/SurfaceEnvironmentContext.js.map +1 -0
  168. package/lib/commonjs/components/SurfaceGroup.js +39 -0
  169. package/lib/commonjs/components/SurfaceGroup.js.map +1 -0
  170. package/lib/commonjs/components/Switch.js +11 -0
  171. package/lib/commonjs/components/Switch.js.map +1 -0
  172. package/lib/commonjs/components/Toast.js +110 -0
  173. package/lib/commonjs/components/Toast.js.map +1 -0
  174. package/lib/commonjs/components/TopAppBar.js +107 -0
  175. package/lib/commonjs/components/TopAppBar.js.map +1 -0
  176. package/lib/commonjs/components/bottomSheetMotion.js +14 -0
  177. package/lib/commonjs/components/bottomSheetMotion.js.map +1 -0
  178. package/lib/commonjs/components/glassControlMaterial.js +22 -0
  179. package/lib/commonjs/components/glassControlMaterial.js.map +1 -0
  180. package/lib/commonjs/components/menuPosition.js +42 -0
  181. package/lib/commonjs/components/menuPosition.js.map +1 -0
  182. package/lib/commonjs/components/pages/FeedPage.js +15 -0
  183. package/lib/commonjs/components/pages/FeedPage.js.map +1 -0
  184. package/lib/commonjs/components/pages/PageBenchmarkContext.js +123 -0
  185. package/lib/commonjs/components/pages/PageBenchmarkContext.js.map +1 -0
  186. package/lib/commonjs/components/pages/SettingsPage.js +47 -0
  187. package/lib/commonjs/components/pages/SettingsPage.js.map +1 -0
  188. package/lib/commonjs/components/pages/SettingsSection.js +14 -0
  189. package/lib/commonjs/components/pages/SettingsSection.js.map +1 -0
  190. package/lib/commonjs/components/pages/StaticSettingsPage.js +16 -0
  191. package/lib/commonjs/components/pages/StaticSettingsPage.js.map +1 -0
  192. package/lib/commonjs/fallbackKnobGeometry.js +19 -0
  193. package/lib/commonjs/fallbackKnobGeometry.js.map +1 -0
  194. package/lib/commonjs/glassController.js +65 -0
  195. package/lib/commonjs/glassController.js.map +1 -0
  196. package/lib/commonjs/glassNativeEngine.js +16 -0
  197. package/lib/commonjs/glassNativeEngine.js.map +1 -0
  198. package/lib/commonjs/glassRuntime.js +27 -0
  199. package/lib/commonjs/glassRuntime.js.map +1 -0
  200. package/lib/commonjs/index.js +218 -0
  201. package/lib/commonjs/index.js.map +1 -0
  202. package/lib/commonjs/inputPresentation.js +17 -0
  203. package/lib/commonjs/inputPresentation.js.map +1 -0
  204. package/lib/commonjs/localGlassTelemetry.js +113 -0
  205. package/lib/commonjs/localGlassTelemetry.js.map +1 -0
  206. package/lib/commonjs/motion/MotionProvider.js +15 -0
  207. package/lib/commonjs/motion/MotionProvider.js.map +1 -0
  208. package/lib/commonjs/motion/easings.js +71 -0
  209. package/lib/commonjs/motion/easings.js.map +1 -0
  210. package/lib/commonjs/motion/folmeSpring.js +24 -0
  211. package/lib/commonjs/motion/folmeSpring.js.map +1 -0
  212. package/lib/commonjs/motion/folmeSpringByResponse.js +22 -0
  213. package/lib/commonjs/motion/folmeSpringByResponse.js.map +1 -0
  214. package/lib/commonjs/motion/index.js +57 -0
  215. package/lib/commonjs/motion/index.js.map +1 -0
  216. package/lib/commonjs/motion/presets.js +101 -0
  217. package/lib/commonjs/motion/presets.js.map +1 -0
  218. package/lib/commonjs/nativeGlassViews.js +33 -0
  219. package/lib/commonjs/nativeGlassViews.js.map +1 -0
  220. package/lib/commonjs/performanceTelemetry.js +28 -0
  221. package/lib/commonjs/performanceTelemetry.js.map +1 -0
  222. package/lib/commonjs/pointerEventBridge.js +17 -0
  223. package/lib/commonjs/pointerEventBridge.js.map +1 -0
  224. package/lib/commonjs/pointerGeometry.js +12 -0
  225. package/lib/commonjs/pointerGeometry.js.map +1 -0
  226. package/lib/commonjs/pressVelocity.js +34 -0
  227. package/lib/commonjs/pressVelocity.js.map +1 -0
  228. package/lib/commonjs/primitives/Divider.js +32 -0
  229. package/lib/commonjs/primitives/Divider.js.map +1 -0
  230. package/lib/commonjs/primitives/Icon.js +22 -0
  231. package/lib/commonjs/primitives/Icon.js.map +1 -0
  232. package/lib/commonjs/primitives/PressIndication.js +58 -0
  233. package/lib/commonjs/primitives/PressIndication.js.map +1 -0
  234. package/lib/commonjs/primitives/Pressable.js +28 -0
  235. package/lib/commonjs/primitives/Pressable.js.map +1 -0
  236. package/lib/commonjs/primitives/PressableScale.js +64 -0
  237. package/lib/commonjs/primitives/PressableScale.js.map +1 -0
  238. package/lib/commonjs/primitives/Surface.js +122 -0
  239. package/lib/commonjs/primitives/Surface.js.map +1 -0
  240. package/lib/commonjs/primitives/Text.js +43 -0
  241. package/lib/commonjs/primitives/Text.js.map +1 -0
  242. package/lib/commonjs/primitives/index.js +18 -0
  243. package/lib/commonjs/primitives/index.js.map +1 -0
  244. package/lib/commonjs/renderer.js +58 -0
  245. package/lib/commonjs/renderer.js.map +1 -0
  246. package/lib/commonjs/sliderValue.js +28 -0
  247. package/lib/commonjs/sliderValue.js.map +1 -0
  248. package/lib/commonjs/surfaceRendererPolicy.js +32 -0
  249. package/lib/commonjs/surfaceRendererPolicy.js.map +1 -0
  250. package/lib/commonjs/theme/ThemeProvider.js +37 -0
  251. package/lib/commonjs/theme/ThemeProvider.js.map +1 -0
  252. package/lib/commonjs/theme/buildTheme.js +157 -0
  253. package/lib/commonjs/theme/buildTheme.js.map +1 -0
  254. package/lib/commonjs/theme/glassColors.js +17 -0
  255. package/lib/commonjs/theme/glassColors.js.map +1 -0
  256. package/lib/commonjs/theme/index.js +38 -0
  257. package/lib/commonjs/theme/index.js.map +1 -0
  258. package/lib/commonjs/theme/liquidGlass.js +24 -0
  259. package/lib/commonjs/theme/liquidGlass.js.map +1 -0
  260. package/lib/commonjs/theme/presentation.js +14 -0
  261. package/lib/commonjs/theme/presentation.js.map +1 -0
  262. package/lib/commonjs/theme/registry.js +17 -0
  263. package/lib/commonjs/theme/registry.js.map +1 -0
  264. package/lib/commonjs/theme/selectVariant.js +13 -0
  265. package/lib/commonjs/theme/selectVariant.js.map +1 -0
  266. package/lib/commonjs/theme/tokens.js +266 -0
  267. package/lib/commonjs/theme/tokens.js.map +1 -0
  268. package/lib/commonjs/theme/types.js +3 -0
  269. package/lib/commonjs/theme/types.js.map +1 -0
  270. package/lib/commonjs/theme/wallpaper.js +91 -0
  271. package/lib/commonjs/theme/wallpaper.js.map +1 -0
  272. package/lib/commonjs/types.js +3 -0
  273. package/lib/commonjs/types.js.map +1 -0
  274. package/lib/commonjs/useButtonGesture.js +135 -0
  275. package/lib/commonjs/useButtonGesture.js.map +1 -0
  276. package/lib/commonjs/useGlassKnobMotion.js +115 -0
  277. package/lib/commonjs/useGlassKnobMotion.js.map +1 -0
  278. package/lib/commonjs/useGlassPressMotion.js +147 -0
  279. package/lib/commonjs/useGlassPressMotion.js.map +1 -0
  280. package/lib/module/GlassSurface.js +782 -0
  281. package/lib/module/GlassSurface.js.map +1 -0
  282. package/lib/module/GlassTabBar.js +939 -0
  283. package/lib/module/GlassTabBar.js.map +1 -0
  284. package/lib/module/GlassTabLens.js +64 -0
  285. package/lib/module/GlassTabLens.js.map +1 -0
  286. package/lib/module/LiquidGlassProvider.js +37 -0
  287. package/lib/module/LiquidGlassProvider.js.map +1 -0
  288. package/lib/module/LocalGlassMaterial.js +191 -0
  289. package/lib/module/LocalGlassMaterial.js.map +1 -0
  290. package/lib/module/adaptiveLuminance.js +11 -0
  291. package/lib/module/adaptiveLuminance.js.map +1 -0
  292. package/lib/module/badgePalette.js +40 -0
  293. package/lib/module/badgePalette.js.map +1 -0
  294. package/lib/module/buttonGesturePolicy.js +17 -0
  295. package/lib/module/buttonGesturePolicy.js.map +1 -0
  296. package/lib/module/components/AdaptiveLuminance.js +16 -0
  297. package/lib/module/components/AdaptiveLuminance.js.map +1 -0
  298. package/lib/module/components/BottomSheet.js +186 -0
  299. package/lib/module/components/BottomSheet.js.map +1 -0
  300. package/lib/module/components/Button.js +17 -0
  301. package/lib/module/components/Button.js.map +1 -0
  302. package/lib/module/components/Card.js +170 -0
  303. package/lib/module/components/Card.js.map +1 -0
  304. package/lib/module/components/Checkbox.js +84 -0
  305. package/lib/module/components/Checkbox.js.map +1 -0
  306. package/lib/module/components/ControlPressContext.js +4 -0
  307. package/lib/module/components/ControlPressContext.js.map +1 -0
  308. package/lib/module/components/Dialog.js +86 -0
  309. package/lib/module/components/Dialog.js.map +1 -0
  310. package/lib/module/components/DialogAction.js +88 -0
  311. package/lib/module/components/DialogAction.js.map +1 -0
  312. package/lib/module/components/DialogContent.js +20 -0
  313. package/lib/module/components/DialogContent.js.map +1 -0
  314. package/lib/module/components/GlassButton.js +93 -0
  315. package/lib/module/components/GlassButton.js.map +1 -0
  316. package/lib/module/components/GlassFab.js +37 -0
  317. package/lib/module/components/GlassFab.js.map +1 -0
  318. package/lib/module/components/GlassMagnifier.js +99 -0
  319. package/lib/module/components/GlassMagnifier.js.map +1 -0
  320. package/lib/module/components/GlassPlayground.js +122 -0
  321. package/lib/module/components/GlassPlayground.js.map +1 -0
  322. package/lib/module/components/GlassSlider.js +328 -0
  323. package/lib/module/components/GlassSlider.js.map +1 -0
  324. package/lib/module/components/GlassSwitch.js +298 -0
  325. package/lib/module/components/GlassSwitch.js.map +1 -0
  326. package/lib/module/components/GlassTabBar.js +351 -0
  327. package/lib/module/components/GlassTabBar.js.map +1 -0
  328. package/lib/module/components/Input.js +144 -0
  329. package/lib/module/components/Input.js.map +1 -0
  330. package/lib/module/components/ListRow.js +61 -0
  331. package/lib/module/components/ListRow.js.map +1 -0
  332. package/lib/module/components/Menu.js +178 -0
  333. package/lib/module/components/Menu.js.map +1 -0
  334. package/lib/module/components/NavigationBar.js +14 -0
  335. package/lib/module/components/NavigationBar.js.map +1 -0
  336. package/lib/module/components/NumberWheel.js +238 -0
  337. package/lib/module/components/NumberWheel.js.map +1 -0
  338. package/lib/module/components/PageFeedList.js +19 -0
  339. package/lib/module/components/PageFeedList.js.map +1 -0
  340. package/lib/module/components/PageScaffold.js +114 -0
  341. package/lib/module/components/PageScaffold.js.map +1 -0
  342. package/lib/module/components/PreferenceGroup.js +28 -0
  343. package/lib/module/components/PreferenceGroup.js.map +1 -0
  344. package/lib/module/components/ProgressIndicator.js +44 -0
  345. package/lib/module/components/ProgressIndicator.js.map +1 -0
  346. package/lib/module/components/ProgressiveBlur.js +26 -0
  347. package/lib/module/components/ProgressiveBlur.js.map +1 -0
  348. package/lib/module/components/ReferenceSlider.js +268 -0
  349. package/lib/module/components/ReferenceSlider.js.map +1 -0
  350. package/lib/module/components/ReferenceTabBar.js +344 -0
  351. package/lib/module/components/ReferenceTabBar.js.map +1 -0
  352. package/lib/module/components/SearchBar.js +164 -0
  353. package/lib/module/components/SearchBar.js.map +1 -0
  354. package/lib/module/components/SegmentedControl.js +26 -0
  355. package/lib/module/components/SegmentedControl.js.map +1 -0
  356. package/lib/module/components/Slider.js +9 -0
  357. package/lib/module/components/Slider.js.map +1 -0
  358. package/lib/module/components/Snackbar.js +8 -0
  359. package/lib/module/components/Snackbar.js.map +1 -0
  360. package/lib/module/components/SurfaceEnvironmentContext.js +27 -0
  361. package/lib/module/components/SurfaceEnvironmentContext.js.map +1 -0
  362. package/lib/module/components/SurfaceGroup.js +33 -0
  363. package/lib/module/components/SurfaceGroup.js.map +1 -0
  364. package/lib/module/components/Switch.js +8 -0
  365. package/lib/module/components/Switch.js.map +1 -0
  366. package/lib/module/components/Toast.js +74 -0
  367. package/lib/module/components/Toast.js.map +1 -0
  368. package/lib/module/components/TopAppBar.js +68 -0
  369. package/lib/module/components/TopAppBar.js.map +1 -0
  370. package/lib/module/components/bottomSheetMotion.js +11 -0
  371. package/lib/module/components/bottomSheetMotion.js.map +1 -0
  372. package/lib/module/components/glassControlMaterial.js +19 -0
  373. package/lib/module/components/glassControlMaterial.js.map +1 -0
  374. package/lib/module/components/menuPosition.js +37 -0
  375. package/lib/module/components/menuPosition.js.map +1 -0
  376. package/lib/module/components/pages/FeedPage.js +12 -0
  377. package/lib/module/components/pages/FeedPage.js.map +1 -0
  378. package/lib/module/components/pages/PageBenchmarkContext.js +84 -0
  379. package/lib/module/components/pages/PageBenchmarkContext.js.map +1 -0
  380. package/lib/module/components/pages/SettingsPage.js +11 -0
  381. package/lib/module/components/pages/SettingsPage.js.map +1 -0
  382. package/lib/module/components/pages/SettingsSection.js +8 -0
  383. package/lib/module/components/pages/SettingsSection.js.map +1 -0
  384. package/lib/module/components/pages/StaticSettingsPage.js +10 -0
  385. package/lib/module/components/pages/StaticSettingsPage.js.map +1 -0
  386. package/lib/module/fallbackKnobGeometry.js +16 -0
  387. package/lib/module/fallbackKnobGeometry.js.map +1 -0
  388. package/lib/module/glassController.js +58 -0
  389. package/lib/module/glassController.js.map +1 -0
  390. package/lib/module/glassNativeEngine.js +11 -0
  391. package/lib/module/glassNativeEngine.js.map +1 -0
  392. package/lib/module/glassRuntime.js +22 -0
  393. package/lib/module/glassRuntime.js.map +1 -0
  394. package/lib/module/index.js +80 -0
  395. package/lib/module/index.js.map +1 -0
  396. package/lib/module/inputPresentation.js +14 -0
  397. package/lib/module/inputPresentation.js.map +1 -0
  398. package/lib/module/localGlassTelemetry.js +103 -0
  399. package/lib/module/localGlassTelemetry.js.map +1 -0
  400. package/lib/module/motion/MotionProvider.js +11 -0
  401. package/lib/module/motion/MotionProvider.js.map +1 -0
  402. package/lib/module/motion/easings.js +64 -0
  403. package/lib/module/motion/easings.js.map +1 -0
  404. package/lib/module/motion/folmeSpring.js +21 -0
  405. package/lib/module/motion/folmeSpring.js.map +1 -0
  406. package/lib/module/motion/folmeSpringByResponse.js +19 -0
  407. package/lib/module/motion/folmeSpringByResponse.js.map +1 -0
  408. package/lib/module/motion/index.js +6 -0
  409. package/lib/module/motion/index.js.map +1 -0
  410. package/lib/module/motion/presets.js +98 -0
  411. package/lib/module/motion/presets.js.map +1 -0
  412. package/lib/module/nativeGlassViews.js +27 -0
  413. package/lib/module/nativeGlassViews.js.map +1 -0
  414. package/lib/module/package.json +1 -0
  415. package/lib/module/performanceTelemetry.js +23 -0
  416. package/lib/module/performanceTelemetry.js.map +1 -0
  417. package/lib/module/pointerEventBridge.js +14 -0
  418. package/lib/module/pointerEventBridge.js.map +1 -0
  419. package/lib/module/pointerGeometry.js +9 -0
  420. package/lib/module/pointerGeometry.js.map +1 -0
  421. package/lib/module/pressVelocity.js +31 -0
  422. package/lib/module/pressVelocity.js.map +1 -0
  423. package/lib/module/primitives/Divider.js +29 -0
  424. package/lib/module/primitives/Divider.js.map +1 -0
  425. package/lib/module/primitives/Icon.js +19 -0
  426. package/lib/module/primitives/Icon.js.map +1 -0
  427. package/lib/module/primitives/PressIndication.js +22 -0
  428. package/lib/module/primitives/PressIndication.js.map +1 -0
  429. package/lib/module/primitives/Pressable.js +25 -0
  430. package/lib/module/primitives/Pressable.js.map +1 -0
  431. package/lib/module/primitives/PressableScale.js +28 -0
  432. package/lib/module/primitives/PressableScale.js.map +1 -0
  433. package/lib/module/primitives/Surface.js +83 -0
  434. package/lib/module/primitives/Surface.js.map +1 -0
  435. package/lib/module/primitives/Text.js +40 -0
  436. package/lib/module/primitives/Text.js.map +1 -0
  437. package/lib/module/primitives/index.js +8 -0
  438. package/lib/module/primitives/index.js.map +1 -0
  439. package/lib/module/renderer.js +22 -0
  440. package/lib/module/renderer.js.map +1 -0
  441. package/lib/module/sliderValue.js +25 -0
  442. package/lib/module/sliderValue.js.map +1 -0
  443. package/lib/module/surfaceRendererPolicy.js +27 -0
  444. package/lib/module/surfaceRendererPolicy.js.map +1 -0
  445. package/lib/module/theme/ThemeProvider.js +32 -0
  446. package/lib/module/theme/ThemeProvider.js.map +1 -0
  447. package/lib/module/theme/buildTheme.js +153 -0
  448. package/lib/module/theme/buildTheme.js.map +1 -0
  449. package/lib/module/theme/glassColors.js +14 -0
  450. package/lib/module/theme/glassColors.js.map +1 -0
  451. package/lib/module/theme/index.js +9 -0
  452. package/lib/module/theme/index.js.map +1 -0
  453. package/lib/module/theme/liquidGlass.js +21 -0
  454. package/lib/module/theme/liquidGlass.js.map +1 -0
  455. package/lib/module/theme/presentation.js +11 -0
  456. package/lib/module/theme/presentation.js.map +1 -0
  457. package/lib/module/theme/registry.js +13 -0
  458. package/lib/module/theme/registry.js.map +1 -0
  459. package/lib/module/theme/selectVariant.js +10 -0
  460. package/lib/module/theme/selectVariant.js.map +1 -0
  461. package/lib/module/theme/tokens.js +262 -0
  462. package/lib/module/theme/tokens.js.map +1 -0
  463. package/lib/module/theme/types.js +2 -0
  464. package/lib/module/theme/types.js.map +1 -0
  465. package/lib/module/theme/wallpaper.js +83 -0
  466. package/lib/module/theme/wallpaper.js.map +1 -0
  467. package/lib/module/types.js +2 -0
  468. package/lib/module/types.js.map +1 -0
  469. package/lib/module/useButtonGesture.js +132 -0
  470. package/lib/module/useButtonGesture.js.map +1 -0
  471. package/lib/module/useGlassKnobMotion.js +112 -0
  472. package/lib/module/useGlassKnobMotion.js.map +1 -0
  473. package/lib/module/useGlassPressMotion.js +143 -0
  474. package/lib/module/useGlassPressMotion.js.map +1 -0
  475. package/lib/types/GlassSurface.d.ts +216 -0
  476. package/lib/types/GlassTabBar.d.ts +35 -0
  477. package/lib/types/GlassTabLens.d.ts +11 -0
  478. package/lib/types/LiquidGlassProvider.d.ts +47 -0
  479. package/lib/types/LocalGlassMaterial.d.ts +21 -0
  480. package/lib/types/adaptiveLuminance.d.ts +2 -0
  481. package/lib/types/badgePalette.d.ts +9 -0
  482. package/lib/types/buttonGesturePolicy.d.ts +4 -0
  483. package/lib/types/components/AdaptiveLuminance.d.ts +23 -0
  484. package/lib/types/components/BottomSheet.d.ts +33 -0
  485. package/lib/types/components/Button.d.ts +16 -0
  486. package/lib/types/components/Card.d.ts +25 -0
  487. package/lib/types/components/Checkbox.d.ts +11 -0
  488. package/lib/types/components/ControlPressContext.d.ts +9 -0
  489. package/lib/types/components/Dialog.d.ts +12 -0
  490. package/lib/types/components/DialogAction.d.ts +4 -0
  491. package/lib/types/components/DialogContent.d.ts +12 -0
  492. package/lib/types/components/GlassButton.d.ts +38 -0
  493. package/lib/types/components/GlassFab.d.ts +15 -0
  494. package/lib/types/components/GlassMagnifier.d.ts +41 -0
  495. package/lib/types/components/GlassPlayground.d.ts +12 -0
  496. package/lib/types/components/GlassSlider.d.ts +48 -0
  497. package/lib/types/components/GlassSwitch.d.ts +46 -0
  498. package/lib/types/components/GlassTabBar.d.ts +44 -0
  499. package/lib/types/components/Input.d.ts +47 -0
  500. package/lib/types/components/ListRow.d.ts +17 -0
  501. package/lib/types/components/Menu.d.ts +41 -0
  502. package/lib/types/components/NavigationBar.d.ts +14 -0
  503. package/lib/types/components/NumberWheel.d.ts +11 -0
  504. package/lib/types/components/PageFeedList.d.ts +6 -0
  505. package/lib/types/components/PageScaffold.d.ts +64 -0
  506. package/lib/types/components/PreferenceGroup.d.ts +12 -0
  507. package/lib/types/components/ProgressIndicator.d.ts +9 -0
  508. package/lib/types/components/ProgressiveBlur.d.ts +12 -0
  509. package/lib/types/components/ReferenceSlider.d.ts +31 -0
  510. package/lib/types/components/ReferenceTabBar.d.ts +61 -0
  511. package/lib/types/components/SearchBar.d.ts +52 -0
  512. package/lib/types/components/SegmentedControl.d.ts +10 -0
  513. package/lib/types/components/Slider.d.ts +19 -0
  514. package/lib/types/components/Snackbar.d.ts +5 -0
  515. package/lib/types/components/SurfaceEnvironmentContext.d.ts +17 -0
  516. package/lib/types/components/SurfaceGroup.d.ts +17 -0
  517. package/lib/types/components/Switch.d.ts +12 -0
  518. package/lib/types/components/Toast.d.ts +14 -0
  519. package/lib/types/components/TopAppBar.d.ts +49 -0
  520. package/lib/types/components/bottomSheetMotion.d.ts +2 -0
  521. package/lib/types/components/glassControlMaterial.d.ts +3 -0
  522. package/lib/types/components/menuPosition.d.ts +22 -0
  523. package/lib/types/components/pages/FeedPage.d.ts +31 -0
  524. package/lib/types/components/pages/PageBenchmarkContext.d.ts +30 -0
  525. package/lib/types/components/pages/SettingsPage.d.ts +20 -0
  526. package/lib/types/components/pages/SettingsSection.d.ts +9 -0
  527. package/lib/types/components/pages/StaticSettingsPage.d.ts +18 -0
  528. package/lib/types/fallbackKnobGeometry.d.ts +7 -0
  529. package/lib/types/glassController.d.ts +20 -0
  530. package/lib/types/glassNativeEngine.d.ts +5 -0
  531. package/lib/types/glassRuntime.d.ts +7 -0
  532. package/lib/types/index.d.ts +124 -0
  533. package/lib/types/inputPresentation.d.ts +12 -0
  534. package/lib/types/localGlassTelemetry.d.ts +28 -0
  535. package/lib/types/motion/MotionProvider.d.ts +7 -0
  536. package/lib/types/motion/easings.d.ts +33 -0
  537. package/lib/types/motion/folmeSpring.d.ts +15 -0
  538. package/lib/types/motion/folmeSpringByResponse.d.ts +14 -0
  539. package/lib/types/motion/index.d.ts +7 -0
  540. package/lib/types/motion/presets.d.ts +103 -0
  541. package/lib/types/nativeGlassViews.d.ts +114 -0
  542. package/lib/types/performanceTelemetry.d.ts +65 -0
  543. package/lib/types/pointerEventBridge.d.ts +17 -0
  544. package/lib/types/pointerGeometry.d.ts +2 -0
  545. package/lib/types/pressVelocity.d.ts +11 -0
  546. package/lib/types/primitives/Divider.d.ts +19 -0
  547. package/lib/types/primitives/Icon.d.ts +29 -0
  548. package/lib/types/primitives/PressIndication.d.ts +26 -0
  549. package/lib/types/primitives/Pressable.d.ts +9 -0
  550. package/lib/types/primitives/PressableScale.d.ts +19 -0
  551. package/lib/types/primitives/Surface.d.ts +63 -0
  552. package/lib/types/primitives/Text.d.ts +35 -0
  553. package/lib/types/primitives/index.d.ts +14 -0
  554. package/lib/types/renderer.d.ts +32 -0
  555. package/lib/types/sliderValue.d.ts +2 -0
  556. package/lib/types/surfaceRendererPolicy.d.ts +14 -0
  557. package/lib/types/theme/ThemeProvider.d.ts +26 -0
  558. package/lib/types/theme/buildTheme.d.ts +6 -0
  559. package/lib/types/theme/glassColors.d.ts +13 -0
  560. package/lib/types/theme/index.d.ts +11 -0
  561. package/lib/types/theme/liquidGlass.d.ts +5 -0
  562. package/lib/types/theme/presentation.d.ts +3 -0
  563. package/lib/types/theme/registry.d.ts +7 -0
  564. package/lib/types/theme/selectVariant.d.ts +10 -0
  565. package/lib/types/theme/tokens.d.ts +18 -0
  566. package/lib/types/theme/types.d.ts +305 -0
  567. package/lib/types/theme/wallpaper.d.ts +32 -0
  568. package/lib/types/types.d.ts +127 -0
  569. package/lib/types/useButtonGesture.d.ts +30 -0
  570. package/lib/types/useGlassKnobMotion.d.ts +40 -0
  571. package/lib/types/useGlassPressMotion.d.ts +61 -0
  572. package/licenses/Apache-2.0-Kyant0-Shapes.txt +191 -0
  573. package/package.json +139 -4
  574. package/patches/liquid-glass-kit+1.0.0.patch +2015 -0
  575. package/patches/liquid-glass-kit-invalidation-coalescing.diff +249 -0
  576. package/patches/liquid-glass-kit-native-infra.diff +624 -0
  577. package/scripts/apply-legacy-patches.mjs +116 -0
  578. package/src/GlassSurface.tsx +1786 -0
  579. package/src/GlassTabBar.tsx +1304 -0
  580. package/src/GlassTabLens.tsx +92 -0
  581. package/src/LiquidGlassProvider.tsx +135 -0
  582. package/src/LocalGlassMaterial.tsx +262 -0
  583. package/src/adaptiveLuminance.ts +15 -0
  584. package/src/badgePalette.ts +54 -0
  585. package/src/buttonGesturePolicy.ts +15 -0
  586. package/src/components/AdaptiveLuminance.tsx +40 -0
  587. package/src/components/BottomSheet.tsx +291 -0
  588. package/src/components/Button.tsx +30 -0
  589. package/src/components/Card.tsx +343 -0
  590. package/src/components/Checkbox.tsx +141 -0
  591. package/src/components/ControlPressContext.ts +11 -0
  592. package/src/components/Dialog.tsx +129 -0
  593. package/src/components/DialogAction.tsx +109 -0
  594. package/src/components/DialogContent.tsx +52 -0
  595. package/src/components/GlassButton.tsx +225 -0
  596. package/src/components/GlassFab.tsx +98 -0
  597. package/src/components/GlassMagnifier.tsx +178 -0
  598. package/src/components/GlassPlayground.tsx +190 -0
  599. package/src/components/GlassSlider.tsx +448 -0
  600. package/src/components/GlassSwitch.tsx +391 -0
  601. package/src/components/GlassTabBar.tsx +522 -0
  602. package/src/components/Input.tsx +277 -0
  603. package/src/components/ListRow.tsx +124 -0
  604. package/src/components/Menu.tsx +322 -0
  605. package/src/components/NavigationBar.tsx +27 -0
  606. package/src/components/NumberWheel.tsx +344 -0
  607. package/src/components/PageFeedList.tsx +37 -0
  608. package/src/components/PageScaffold.tsx +266 -0
  609. package/src/components/PreferenceGroup.tsx +65 -0
  610. package/src/components/ProgressIndicator.tsx +63 -0
  611. package/src/components/ProgressiveBlur.tsx +56 -0
  612. package/src/components/ReferenceSlider.tsx +364 -0
  613. package/src/components/ReferenceTabBar.tsx +564 -0
  614. package/src/components/SearchBar.tsx +340 -0
  615. package/src/components/SegmentedControl.tsx +45 -0
  616. package/src/components/Slider.tsx +25 -0
  617. package/src/components/Snackbar.tsx +10 -0
  618. package/src/components/SurfaceEnvironmentContext.tsx +46 -0
  619. package/src/components/SurfaceGroup.tsx +60 -0
  620. package/src/components/Switch.tsx +18 -0
  621. package/src/components/Toast.tsx +110 -0
  622. package/src/components/TopAppBar.tsx +272 -0
  623. package/src/components/bottomSheetMotion.ts +10 -0
  624. package/src/components/glassControlMaterial.ts +20 -0
  625. package/src/components/menuPosition.ts +58 -0
  626. package/src/components/pages/FeedPage.tsx +96 -0
  627. package/src/components/pages/PageBenchmarkContext.tsx +105 -0
  628. package/src/components/pages/SettingsPage.tsx +55 -0
  629. package/src/components/pages/SettingsSection.tsx +20 -0
  630. package/src/components/pages/StaticSettingsPage.tsx +50 -0
  631. package/src/fallbackKnobGeometry.ts +15 -0
  632. package/src/glassController.ts +74 -0
  633. package/src/glassNativeEngine.ts +16 -0
  634. package/src/glassRuntime.ts +28 -0
  635. package/src/index.ts +199 -0
  636. package/src/inputPresentation.ts +32 -0
  637. package/src/localGlassTelemetry.ts +138 -0
  638. package/src/motion/MotionProvider.tsx +12 -0
  639. package/src/motion/easings.ts +71 -0
  640. package/src/motion/folmeSpring.ts +22 -0
  641. package/src/motion/folmeSpringByResponse.ts +19 -0
  642. package/src/motion/index.ts +47 -0
  643. package/src/motion/presets.ts +128 -0
  644. package/src/nativeGlassViews.ts +147 -0
  645. package/src/performanceTelemetry.ts +95 -0
  646. package/src/pointerEventBridge.ts +27 -0
  647. package/src/pointerGeometry.ts +8 -0
  648. package/src/pressVelocity.ts +36 -0
  649. package/src/primitives/Divider.tsx +42 -0
  650. package/src/primitives/Icon.tsx +44 -0
  651. package/src/primitives/PressIndication.tsx +43 -0
  652. package/src/primitives/Pressable.tsx +75 -0
  653. package/src/primitives/PressableScale.tsx +50 -0
  654. package/src/primitives/Surface.tsx +171 -0
  655. package/src/primitives/Text.tsx +80 -0
  656. package/src/primitives/index.ts +14 -0
  657. package/src/renderer.ts +70 -0
  658. package/src/sliderValue.ts +19 -0
  659. package/src/surfaceRendererPolicy.ts +32 -0
  660. package/src/theme/ThemeProvider.tsx +52 -0
  661. package/src/theme/buildTheme.ts +160 -0
  662. package/src/theme/glassColors.ts +13 -0
  663. package/src/theme/index.ts +34 -0
  664. package/src/theme/liquidGlass.ts +25 -0
  665. package/src/theme/presentation.ts +12 -0
  666. package/src/theme/registry.ts +16 -0
  667. package/src/theme/selectVariant.ts +12 -0
  668. package/src/theme/tokens.ts +309 -0
  669. package/src/theme/types.ts +345 -0
  670. package/src/theme/wallpaper.ts +94 -0
  671. package/src/types.ts +95 -0
  672. package/src/useButtonGesture.ts +134 -0
  673. package/src/useGlassKnobMotion.ts +155 -0
  674. package/src/useGlassPressMotion.ts +209 -0
@@ -0,0 +1,976 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.GLASS_TAB_BAR_CONTENT_INSET = void 0;
37
+ exports.GlassTabBar = GlassTabBar;
38
+ const jsx_runtime_1 = require("react/jsx-runtime");
39
+ const react_1 = __importStar(require("react"));
40
+ const react_native_1 = require("react-native");
41
+ const Haptics = __importStar(require("expo-haptics"));
42
+ const react_native_gesture_handler_1 = require("react-native-gesture-handler");
43
+ const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
44
+ const ReferenceTabBar_1 = require("./components/ReferenceTabBar");
45
+ const GlassSurface_1 = require("./GlassSurface");
46
+ const glassNativeEngine_1 = require("./glassNativeEngine");
47
+ const nativeGlassViews_1 = require("./nativeGlassViews");
48
+ const TAB_BAR_HEIGHT = 64;
49
+ const TAB_BAR_BOTTOM_GAP = 8;
50
+ const TAB_BAR_SCROLL_CLEARANCE = 12;
51
+ const TAB_BAR_SIDE_MARGIN = 16;
52
+ const TAB_BAR_MAX_WIDTH = 280;
53
+ const TAB_BAR_MIN_WIDTH = 208;
54
+ const TAB_BAR_HORIZONTAL_PADDING = 8;
55
+ const SELECTION_LENS_HEIGHT = 48;
56
+ const SELECTION_LENS_MAX_WIDTH = 94;
57
+ const LONG_PRESS_THRESHOLD_MS = 300;
58
+ const PRE_HOLD_SLOP = 20;
59
+ const DRAG_START_SLOP = 3;
60
+ const TAB_BAR_PORTAL_Z_INDEX = 80;
61
+ const GESTURE_DEBUG_ENABLED = __DEV__ && process.env.EXPO_PUBLIC_GLASS_TAB_DEBUG === '1';
62
+ const IDLE_SPRING = { damping: 24, stiffness: 330, mass: 0.68 };
63
+ const TAP_SELECTION_SPRING = { damping: 26, stiffness: 520, mass: 0.56 };
64
+ const EDGE_SPRING_FAST = { damping: 31, stiffness: 620, mass: 0.62 };
65
+ const EDGE_SPRING_SLOW = { damping: 29, stiffness: 260, mass: 0.76 };
66
+ const AnimatedLegacyGlassSurface = (0, react_native_reanimated_1.createAnimatedComponent)(nativeGlassViews_1.LegacyGlassSurfaceView);
67
+ const AnimatedCoreGlassSurface = nativeGlassViews_1.CoreGlassSurfaceView
68
+ ? (0, react_native_reanimated_1.createAnimatedComponent)(nativeGlassViews_1.CoreGlassSurfaceView)
69
+ : null;
70
+ function logGlassTabGesture(event, detail) {
71
+ if (GESTURE_DEBUG_ENABLED) {
72
+ const timestamp = globalThis.performance?.now?.();
73
+ const time = typeof timestamp === 'number' ? timestamp.toFixed(1) : 'n/a';
74
+ console.info(`[GlassTab ${time}ms] ${event}${detail ? ` ${detail}` : ''}`);
75
+ }
76
+ }
77
+ /** Extra scroll room below content: bar height + bottom gap + visual clearance. */
78
+ exports.GLASS_TAB_BAR_CONTENT_INSET = TAB_BAR_HEIGHT + TAB_BAR_BOTTOM_GAP + TAB_BAR_SCROLL_CLEARANCE;
79
+ function emitTargetHaptic(_index) {
80
+ void Haptics.selectionAsync().catch(() => undefined);
81
+ }
82
+ function withAlpha(color, alpha, fallback) {
83
+ const value = color.trim();
84
+ const rgba = value.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);
85
+ if (rgba)
86
+ return `rgba(${Math.round(Number(rgba[1]))},${Math.round(Number(rgba[2]))},${Math.round(Number(rgba[3]))},${alpha})`;
87
+ const hex = value.replace(/^#/, '');
88
+ if (/^[\da-f]{3}$/i.test(hex)) {
89
+ return `rgba(${parseInt(hex[0] + hex[0], 16)},${parseInt(hex[1] + hex[1], 16)},${parseInt(hex[2] + hex[2], 16)},${alpha})`;
90
+ }
91
+ if (/^[\da-f]{6}([\da-f]{2})?$/i.test(hex)) {
92
+ return `rgba(${parseInt(hex.slice(0, 2), 16)},${parseInt(hex.slice(2, 4), 16)},${parseInt(hex.slice(4, 6), 16)},${alpha})`;
93
+ }
94
+ return fallback;
95
+ }
96
+ /**
97
+ * Floating navigation shares the catalog's reference renderer. Inline custom
98
+ * selectors retain their content API and independent interaction geometry.
99
+ */
100
+ function GlassTabBar(props) {
101
+ return props.presentation === 'inline'
102
+ ? (0, jsx_runtime_1.jsx)(InlineGlassTabBar, { ...props })
103
+ : (0, jsx_runtime_1.jsx)(FloatingGlassTabBar, { ...props });
104
+ }
105
+ function FloatingGlassTabBar({ items, selected, onSelect, onSelectFromDrag, renderIcon, renderItem, bottomInset = 0, height = TAB_BAR_HEIGHT, width: requestedWidth, accessibilityHint, }) {
106
+ const { width: windowWidth } = (0, react_native_1.useWindowDimensions)();
107
+ const samplingProviderId = (0, GlassSurface_1.useGlassSamplingProviderId)('routeScene');
108
+ const width = Math.min(typeof requestedWidth === 'number' ? requestedWidth : 320, Math.max(0, windowWidth - TAB_BAR_SIDE_MARGIN * 2));
109
+ return ((0, jsx_runtime_1.jsx)(GlassSurface_1.GlassOverlay, { zIndex: TAB_BAR_PORTAL_Z_INDEX + 1, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: { position: 'absolute', left: (windowWidth - width) / 2,
110
+ bottom: bottomInset + TAB_BAR_BOTTOM_GAP, width, height }, children: (0, jsx_runtime_1.jsx)(ReferenceTabBar_1.ReferenceTabBar, { items: items, selected: selected, onSelect: onSelect, onReselect: onSelect, onSelectFromDrag: onSelectFromDrag, height: height, renderIcon: renderIcon ? (index, active) => renderIcon(items[index], index, active) : undefined, renderItem: renderItem ? (index, active) => renderItem(items[index], index, active) : undefined, accessibilityLabel: "\u5E95\u90E8\u5BFC\u822A", accessibilityHint: accessibilityHint, samplingProviderIdOverride: samplingProviderId }) }) }));
111
+ }
112
+ function InlineGlassTabBar({ items, selected, bottomInset = 0, shellBackgroundColor, onSelect, onSelectFromDrag, renderIcon, renderItem, presentation = 'floating', height = TAB_BAR_HEIGHT, width: requestedWidth, horizontalPadding = TAB_BAR_HORIZONTAL_PADDING, shellRadius, lensMaxWidth = SELECTION_LENS_MAX_WIDTH, lensRefractionHeight, accessibilityHint, }) {
113
+ const { width: windowWidth, height: windowHeight } = (0, react_native_1.useWindowDimensions)();
114
+ const nativeEngine = (0, react_1.useSyncExternalStore)(glassNativeEngine_1.subscribeGlassNativeEngine, glassNativeEngine_1.getGlassNativeEngine, glassNativeEngine_1.getGlassNativeEngine);
115
+ const appearance = (0, GlassSurface_1.useGlassAppearance)();
116
+ const reducedMotion = (0, GlassSurface_1.useGlassReducedMotion)();
117
+ const tabBarMaterial = appearance?.tokens.materials.tabBarShell ?? appearance?.tokens.materials.tabBar;
118
+ const nativeLiveAvailable = react_native_1.Platform.OS === 'android' && appearance?.tokens.quality !== 'fallback';
119
+ const NativeGlassSurface = nativeEngine === 'core' && AnimatedCoreGlassSurface
120
+ ? AnimatedCoreGlassSurface
121
+ : AnimatedLegacyGlassSurface;
122
+ const dark = appearance?.dark ?? false;
123
+ const shellSurfaceColor = shellBackgroundColor
124
+ ? withAlpha(shellBackgroundColor, 0.4, dark ? 'rgba(18,18,18,0.4)' : 'rgba(250,250,250,0.4)')
125
+ : dark ? 'rgba(18,18,18,0.4)' : 'rgba(250,250,250,0.4)';
126
+ // An inline bar is drawn inside the page's route capture source. Pointing the
127
+ // selection lens at that same source makes the captured RenderNode contain the
128
+ // lens whose RenderEffect consumes it - a cycle that overflowed the stack in
129
+ // RenderNode::prepareTreeImpl on the User page. Inline lenses sample the theme
130
+ // backdrop instead, which is never an ancestor of the lens itself.
131
+ const samplingProviderId = (0, GlassSurface_1.useGlassSamplingProviderId)(presentation === 'inline' ? 'themeBackdrop' : 'routeScene') ?? '';
132
+ const tabScopeId = (0, react_1.useId)();
133
+ const [inlineWidth, setInlineWidth] = (0, react_1.useState)(0);
134
+ const shellBorderColor = appearance?.tokens.fallbackBorder[dark ? 'dark' : 'light'] ?? 'transparent';
135
+ const shellShadowColor = appearance?.tokens.procedural.outerShadow[dark ? 'dark' : 'light'] ?? 'transparent';
136
+ const itemCount = Math.max(items.length, 1);
137
+ const desiredWidth = itemCount * 100 + TAB_BAR_HORIZONTAL_PADDING * 2;
138
+ const floatingWidth = Math.min(Math.min(TAB_BAR_MAX_WIDTH, Math.max(TAB_BAR_MIN_WIDTH, desiredWidth)), Math.max(0, windowWidth - TAB_BAR_SIDE_MARGIN * 2));
139
+ const barWidth = presentation === 'inline'
140
+ ? (typeof requestedWidth === 'number' ? requestedWidth : inlineWidth)
141
+ : floatingWidth;
142
+ const itemWidth = Math.max(0, (barWidth - horizontalPadding * 2) / itemCount);
143
+ const lensWidth = Math.max(44, Math.min(lensMaxWidth, itemWidth - 8));
144
+ const lensBaseHeight = Math.min(SELECTION_LENS_HEIGHT, height - 8);
145
+ const verticalInset = (height - lensBaseHeight) / 2;
146
+ const selectedCenterX = horizontalPadding + itemWidth * (selected + 0.5);
147
+ const selectedLeft = selectedCenterX - lensWidth / 2;
148
+ const [inlineScreenLeft, setInlineScreenLeft] = (0, react_1.useState)(0);
149
+ const inlineHostRef = (0, react_1.useRef)(null);
150
+ const shellScreenLeft = presentation === 'floating' ? (windowWidth - barWidth) / 2 : inlineScreenLeft;
151
+ // The shell lives inside the floating glass overlay, where measureInWindow
152
+ // returns a rect from the wrong native branch. Publish the geometry the bar
153
+ // is actually laid out at instead of trusting that measurement.
154
+ const shellFrameOverride = presentation === 'floating'
155
+ ? {
156
+ x: shellScreenLeft,
157
+ y: windowHeight - bottomInset - TAB_BAR_BOTTOM_GAP - height,
158
+ width: barWidth,
159
+ height,
160
+ }
161
+ : undefined;
162
+ const lensLeft = (0, react_native_reanimated_1.useSharedValue)(selectedLeft);
163
+ const lensRight = (0, react_native_reanimated_1.useSharedValue)(selectedLeft + lensWidth);
164
+ const lensHeight = (0, react_native_reanimated_1.useSharedValue)(lensBaseHeight);
165
+ const lensOffsetY = (0, react_native_reanimated_1.useSharedValue)(0);
166
+ const interactionProgress = (0, react_native_reanimated_1.useSharedValue)(0);
167
+ const phase = (0, react_native_reanimated_1.useSharedValue)('idle');
168
+ const grabOffsetX = (0, react_native_reanimated_1.useSharedValue)(0);
169
+ const originSelectedIndex = (0, react_native_reanimated_1.useSharedValue)(selected);
170
+ const hoveredIndex = (0, react_native_reanimated_1.useSharedValue)(selected);
171
+ const pendingIndex = (0, react_native_reanimated_1.useSharedValue)(selected);
172
+ const snapStarted = (0, react_native_reanimated_1.useSharedValue)(false);
173
+ const interactionActive = (0, react_native_reanimated_1.useSharedValue)(false);
174
+ const holdCandidate = (0, react_native_reanimated_1.useSharedValue)(false);
175
+ const holdActivated = (0, react_native_reanimated_1.useSharedValue)(false);
176
+ const panActivated = (0, react_native_reanimated_1.useSharedValue)(false);
177
+ const panActivationRequested = (0, react_native_reanimated_1.useSharedValue)(false);
178
+ const panUpdateLogged = (0, react_native_reanimated_1.useSharedValue)(false);
179
+ const touchSessionActive = (0, react_native_reanimated_1.useSharedValue)(false);
180
+ const touchMovedPastSlop = (0, react_native_reanimated_1.useSharedValue)(false);
181
+ const sessionId = (0, react_native_reanimated_1.useSharedValue)(0);
182
+ const touchedIndex = (0, react_native_reanimated_1.useSharedValue)(selected);
183
+ const holdTimerProgress = (0, react_native_reanimated_1.useSharedValue)(0);
184
+ const touchStartX = (0, react_native_reanimated_1.useSharedValue)(0);
185
+ const touchStartY = (0, react_native_reanimated_1.useSharedValue)(0);
186
+ const lastHapticIndex = (0, react_native_reanimated_1.useSharedValue)(-1);
187
+ const dragVelocityX = (0, react_native_reanimated_1.useSharedValue)(0);
188
+ const dragVelocityY = (0, react_native_reanimated_1.useSharedValue)(0);
189
+ const [liveBackdropEnabled, setLiveBackdropEnabled] = (0, react_1.useState)(false);
190
+ const interactionActiveRef = (0, react_1.useRef)(false);
191
+ const dragCommittedTargetRef = (0, react_1.useRef)(null);
192
+ const previousGeometryRef = (0, react_1.useRef)({ selected, barWidth: 0 });
193
+ const [gestureDebug, setGestureDebug] = (0, react_1.useState)({
194
+ phase: 'idle',
195
+ holdCandidate: false,
196
+ holdActivated: false,
197
+ dragging: false,
198
+ snapStarted: false,
199
+ gestureCount: 0,
200
+ origin: selected,
201
+ hovered: selected,
202
+ pending: selected,
203
+ touchCount: 0,
204
+ });
205
+ const noteTabViewTouch = (0, react_1.useCallback)(() => {
206
+ if (GESTURE_DEBUG_ENABLED)
207
+ setGestureDebug((current) => ({ ...current, touchCount: current.touchCount + 1 }));
208
+ }, []);
209
+ const noteGestureDown = (0, react_1.useCallback)(() => {
210
+ if (GESTURE_DEBUG_ENABLED)
211
+ setGestureDebug((current) => ({ ...current, gestureCount: current.gestureCount + 1 }));
212
+ }, []);
213
+ const updateGestureDebug = (0, react_1.useCallback)((nextPhase, nextHoldCandidate, nextHoldActivated, nextDragging, nextSnapStarted, origin, hovered, pending) => {
214
+ if (!GESTURE_DEBUG_ENABLED)
215
+ return;
216
+ setGestureDebug((current) => ({
217
+ ...current,
218
+ phase: nextPhase,
219
+ holdCandidate: nextHoldCandidate,
220
+ holdActivated: nextHoldActivated,
221
+ dragging: nextDragging,
222
+ snapStarted: nextSnapStarted,
223
+ origin,
224
+ hovered,
225
+ pending,
226
+ }));
227
+ }, []);
228
+ (0, react_native_reanimated_1.useAnimatedReaction)(() => ({
229
+ phase: phase.value,
230
+ holdCandidate: holdCandidate.value,
231
+ holdActivated: holdActivated.value,
232
+ dragging: panActivated.value,
233
+ snapStarted: snapStarted.value,
234
+ origin: originSelectedIndex.value,
235
+ hovered: hoveredIndex.value,
236
+ pending: pendingIndex.value,
237
+ }), (current, previous) => {
238
+ if (!GESTURE_DEBUG_ENABLED)
239
+ return;
240
+ if (previous == null ||
241
+ current.phase !== previous.phase ||
242
+ current.holdCandidate !== previous.holdCandidate ||
243
+ current.holdActivated !== previous.holdActivated ||
244
+ current.dragging !== previous.dragging ||
245
+ current.snapStarted !== previous.snapStarted ||
246
+ current.origin !== previous.origin ||
247
+ current.hovered !== previous.hovered ||
248
+ current.pending !== previous.pending) {
249
+ (0, react_native_reanimated_1.runOnJS)(updateGestureDebug)(current.phase, current.holdCandidate, current.holdActivated, current.dragging, current.snapStarted, current.origin, current.hovered, current.pending);
250
+ }
251
+ }, [holdCandidate, holdActivated, hoveredIndex, originSelectedIndex, panActivated, pendingIndex, phase, snapStarted, updateGestureDebug]);
252
+ const beginInteraction = (0, react_1.useCallback)(() => {
253
+ interactionActiveRef.current = true;
254
+ dragCommittedTargetRef.current = null;
255
+ if (nativeLiveAvailable)
256
+ setLiveBackdropEnabled(true);
257
+ void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light).catch(() => undefined);
258
+ }, [nativeLiveAvailable]);
259
+ const activateHoldOnUI = (0, react_1.useCallback)((expectedSessionId, expectedIndex) => {
260
+ 'worklet';
261
+ if (!touchSessionActive.value ||
262
+ sessionId.value !== expectedSessionId ||
263
+ !holdCandidate.value ||
264
+ touchMovedPastSlop.value ||
265
+ expectedIndex !== selected)
266
+ return;
267
+ holdCandidate.value = false;
268
+ holdActivated.value = true;
269
+ phase.value = 'inflating';
270
+ interactionActive.value = true;
271
+ originSelectedIndex.value = selected;
272
+ hoveredIndex.value = selected;
273
+ pendingIndex.value = selected;
274
+ const currentCenter = (lensLeft.value + lensRight.value) / 2;
275
+ grabOffsetX.value = touchStartX.value - shellScreenLeft - currentCenter;
276
+ const expandedWidth = lensWidth + (reducedMotion ? 8 : 20);
277
+ const expandedHeight = lensBaseHeight + (reducedMotion ? 4 : 10);
278
+ lensLeft.value = (0, react_native_reanimated_1.withSpring)(currentCenter - expandedWidth / 2, reducedMotion ? IDLE_SPRING : { damping: 23, stiffness: 360, mass: 0.7 });
279
+ lensRight.value = (0, react_native_reanimated_1.withSpring)(currentCenter + expandedWidth / 2, reducedMotion ? IDLE_SPRING : { damping: 23, stiffness: 360, mass: 0.7 });
280
+ lensHeight.value = (0, react_native_reanimated_1.withSpring)(expandedHeight, reducedMotion ? { damping: 25, stiffness: 390 } : { damping: 23, stiffness: 350, mass: 0.7 });
281
+ interactionProgress.value = (0, react_native_reanimated_1.withTiming)(1, { duration: reducedMotion ? 85 : 135 });
282
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('HOLD_ACTIVE', `index=${selected}`);
283
+ (0, react_native_reanimated_1.runOnJS)(beginInteraction)();
284
+ if (GESTURE_DEBUG_ENABLED) {
285
+ (0, react_native_reanimated_1.runOnJS)(updateGestureDebug)('inflating', false, true, false, false, selected, selected, selected);
286
+ }
287
+ }, [beginInteraction, grabOffsetX, holdActivated, holdCandidate, hoveredIndex, interactionActive, interactionProgress, lensBaseHeight, lensHeight, lensLeft, lensRight, lensWidth, originSelectedIndex, pendingIndex, phase, reducedMotion, selected, sessionId, shellScreenLeft, touchMovedPastSlop, touchSessionActive, touchStartX, updateGestureDebug]);
288
+ const commitDragSelection = (0, react_1.useCallback)((targetIndex, startIndex) => {
289
+ const safeTarget = Math.max(0, Math.min(itemCount - 1, targetIndex));
290
+ const safeStart = Math.max(0, Math.min(itemCount - 1, startIndex));
291
+ if (safeTarget === safeStart || dragCommittedTargetRef.current !== null)
292
+ return;
293
+ // Mark this as the drag's own page change before notifying navigation.
294
+ // The selection effect must leave the remaining glass settle intact.
295
+ dragCommittedTargetRef.current = safeTarget;
296
+ previousGeometryRef.current = { selected: safeTarget, barWidth };
297
+ logGlassTabGesture('COMMIT', `target=${safeTarget}`);
298
+ (onSelectFromDrag ?? onSelect)(safeTarget);
299
+ }, [barWidth, itemCount, onSelect, onSelectFromDrag]);
300
+ const finishInteraction = (0, react_1.useCallback)((targetIndex) => {
301
+ const safeTarget = Math.max(0, Math.min(itemCount - 1, targetIndex));
302
+ interactionActiveRef.current = false;
303
+ setLiveBackdropEnabled(false);
304
+ previousGeometryRef.current = { selected: safeTarget, barWidth };
305
+ dragCommittedTargetRef.current = null;
306
+ logGlassTabGesture('BACKDROP_OFF');
307
+ logGlassTabGesture('RESET');
308
+ }, [barWidth, itemCount]);
309
+ const resetInteractionOnUI = (0, react_1.useCallback)((targetIndex) => {
310
+ 'worklet';
311
+ const safeTarget = Math.max(0, Math.min(itemCount - 1, targetIndex));
312
+ if (phase.value === 'idle' && !interactionActive.value && !snapStarted.value)
313
+ return;
314
+ // Mark idle before cancelling. A cancelled animation callback can
315
+ // re-enter this function, where it will now be a harmless no-op.
316
+ phase.value = 'idle';
317
+ interactionActive.value = false;
318
+ snapStarted.value = false;
319
+ holdCandidate.value = false;
320
+ holdActivated.value = false;
321
+ panActivated.value = false;
322
+ panActivationRequested.value = false;
323
+ panUpdateLogged.value = false;
324
+ touchSessionActive.value = false;
325
+ touchMovedPastSlop.value = false;
326
+ touchStartX.value = 0;
327
+ touchStartY.value = 0;
328
+ touchedIndex.value = safeTarget;
329
+ (0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
330
+ holdTimerProgress.value = 0;
331
+ (0, react_native_reanimated_1.cancelAnimation)(lensLeft);
332
+ (0, react_native_reanimated_1.cancelAnimation)(lensRight);
333
+ (0, react_native_reanimated_1.cancelAnimation)(lensHeight);
334
+ (0, react_native_reanimated_1.cancelAnimation)(lensOffsetY);
335
+ (0, react_native_reanimated_1.cancelAnimation)(interactionProgress);
336
+ const center = horizontalPadding + itemWidth * (safeTarget + 0.5);
337
+ const left = center - lensWidth / 2;
338
+ lensLeft.value = left;
339
+ lensRight.value = left + lensWidth;
340
+ lensHeight.value = lensBaseHeight;
341
+ lensOffsetY.value = 0;
342
+ interactionProgress.value = 0;
343
+ dragVelocityX.value = 0;
344
+ dragVelocityY.value = 0;
345
+ originSelectedIndex.value = safeTarget;
346
+ hoveredIndex.value = safeTarget;
347
+ pendingIndex.value = safeTarget;
348
+ lastHapticIndex.value = -1;
349
+ (0, react_native_reanimated_1.runOnJS)(finishInteraction)(safeTarget);
350
+ }, [dragVelocityX, dragVelocityY, finishInteraction, holdActivated, holdCandidate, holdTimerProgress, horizontalPadding, hoveredIndex, interactionActive, interactionProgress, itemCount, itemWidth, lastHapticIndex, lensBaseHeight, lensHeight, lensLeft, lensOffsetY, lensRight, lensWidth, originSelectedIndex, panActivated, panActivationRequested, panUpdateLogged, pendingIndex, phase, snapStarted, touchMovedPastSlop, touchSessionActive, touchStartX, touchStartY, touchedIndex]);
351
+ (0, react_1.useEffect)(() => {
352
+ if (barWidth <= 0)
353
+ return;
354
+ const previous = previousGeometryRef.current;
355
+ const initialMeasurement = previous.barWidth <= 0;
356
+ const selectionChanged = previous.selected !== selected;
357
+ const widthChanged = previous.barWidth > 0 && previous.barWidth !== barWidth;
358
+ if (dragCommittedTargetRef.current === selected) {
359
+ // Our drag already placed the lens at this page. Do not cancel its
360
+ // settling animation or run the normal tap-selection spring again.
361
+ previousGeometryRef.current = { selected, barWidth };
362
+ return;
363
+ }
364
+ if (interactionActiveRef.current || interactionActive.value || phase.value !== 'idle') {
365
+ // An external page change during a live gesture takes ownership:
366
+ // cancel its animations and reconcile once the external selection
367
+ // is known. A drag's own commit pre-updates previousGeometryRef.
368
+ if (selectionChanged) {
369
+ phase.value = 'idle';
370
+ interactionActive.value = false;
371
+ snapStarted.value = false;
372
+ holdCandidate.value = false;
373
+ holdActivated.value = false;
374
+ panActivated.value = false;
375
+ panActivationRequested.value = false;
376
+ panUpdateLogged.value = false;
377
+ touchSessionActive.value = false;
378
+ touchMovedPastSlop.value = false;
379
+ touchStartX.value = 0;
380
+ touchStartY.value = 0;
381
+ touchedIndex.value = selected;
382
+ sessionId.value += 1;
383
+ (0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
384
+ holdTimerProgress.value = 0;
385
+ (0, react_native_reanimated_1.cancelAnimation)(lensLeft);
386
+ (0, react_native_reanimated_1.cancelAnimation)(lensRight);
387
+ (0, react_native_reanimated_1.cancelAnimation)(lensHeight);
388
+ (0, react_native_reanimated_1.cancelAnimation)(lensOffsetY);
389
+ (0, react_native_reanimated_1.cancelAnimation)(interactionProgress);
390
+ const safeIndex = Math.max(0, Math.min(itemCount - 1, selected));
391
+ const center = horizontalPadding + itemWidth * (safeIndex + 0.5);
392
+ const left = center - lensWidth / 2;
393
+ lensLeft.value = left;
394
+ lensRight.value = left + lensWidth;
395
+ lensHeight.value = lensBaseHeight;
396
+ lensOffsetY.value = 0;
397
+ interactionProgress.value = 0;
398
+ dragVelocityX.value = 0;
399
+ dragVelocityY.value = 0;
400
+ hoveredIndex.value = safeIndex;
401
+ pendingIndex.value = safeIndex;
402
+ originSelectedIndex.value = safeIndex;
403
+ lastHapticIndex.value = -1;
404
+ interactionActiveRef.current = false;
405
+ setLiveBackdropEnabled(false);
406
+ dragCommittedTargetRef.current = null;
407
+ logGlassTabGesture('BACKDROP_OFF');
408
+ logGlassTabGesture('RESET', 'external_selection');
409
+ previousGeometryRef.current = { selected, barWidth };
410
+ }
411
+ // Keep same-selection and layout changes pending while the
412
+ // session owns the lens; reconcile them after it finishes.
413
+ return;
414
+ }
415
+ if (!initialMeasurement && !selectionChanged && !widthChanged)
416
+ return;
417
+ const safeIndex = Math.max(0, Math.min(itemCount - 1, selected));
418
+ const nextCenter = horizontalPadding + itemWidth * (safeIndex + 0.5);
419
+ const nextLeft = nextCenter - lensWidth / 2;
420
+ if (initialMeasurement) {
421
+ lensLeft.value = nextLeft;
422
+ lensRight.value = nextLeft + lensWidth;
423
+ lensHeight.value = lensBaseHeight;
424
+ }
425
+ else if (reducedMotion) {
426
+ lensLeft.value = (0, react_native_reanimated_1.withTiming)(nextLeft, { duration: 115 });
427
+ lensRight.value = (0, react_native_reanimated_1.withTiming)(nextLeft + lensWidth, { duration: 115 });
428
+ lensHeight.value = (0, react_native_reanimated_1.withTiming)(lensBaseHeight, { duration: 95 });
429
+ }
430
+ else {
431
+ lensLeft.value = (0, react_native_reanimated_1.withSpring)(nextLeft, TAP_SELECTION_SPRING);
432
+ lensRight.value = (0, react_native_reanimated_1.withSpring)(nextLeft + lensWidth, TAP_SELECTION_SPRING);
433
+ lensHeight.value = (0, react_native_reanimated_1.withSpring)(lensBaseHeight, { damping: 28, stiffness: 500, mass: 0.55 });
434
+ }
435
+ lensOffsetY.value = (0, react_native_reanimated_1.withTiming)(0, { duration: 110 });
436
+ previousGeometryRef.current = { selected, barWidth };
437
+ }, [barWidth, dragVelocityX, dragVelocityY, holdActivated, holdCandidate, holdTimerProgress, horizontalPadding, hoveredIndex, interactionActive, interactionProgress, itemCount, itemWidth, lastHapticIndex, lensBaseHeight, lensHeight, lensLeft, lensOffsetY, lensRight, lensWidth, originSelectedIndex, panActivated, panActivationRequested, panUpdateLogged, pendingIndex, phase, reducedMotion, selected, sessionId, snapStarted, touchMovedPastSlop, touchSessionActive, touchStartX, touchStartY, touchedIndex]);
438
+ (0, react_1.useEffect)(() => () => {
439
+ (0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
440
+ phase.value = 'idle';
441
+ interactionActive.value = false;
442
+ snapStarted.value = false;
443
+ holdCandidate.value = false;
444
+ holdActivated.value = false;
445
+ panActivated.value = false;
446
+ panActivationRequested.value = false;
447
+ panUpdateLogged.value = false;
448
+ touchSessionActive.value = false;
449
+ touchMovedPastSlop.value = false;
450
+ sessionId.value += 1;
451
+ touchedIndex.value = -1;
452
+ touchStartX.value = 0;
453
+ touchStartY.value = 0;
454
+ interactionActiveRef.current = false;
455
+ (0, react_native_reanimated_1.cancelAnimation)(lensLeft);
456
+ (0, react_native_reanimated_1.cancelAnimation)(lensRight);
457
+ (0, react_native_reanimated_1.cancelAnimation)(lensHeight);
458
+ (0, react_native_reanimated_1.cancelAnimation)(lensOffsetY);
459
+ (0, react_native_reanimated_1.cancelAnimation)(interactionProgress);
460
+ }, [holdActivated, holdCandidate, holdTimerProgress, interactionActive, interactionProgress, lensHeight, lensLeft, lensOffsetY, lensRight, panActivated, panActivationRequested, panUpdateLogged, phase, sessionId, snapStarted, touchMovedPastSlop, touchSessionActive, touchStartX, touchStartY, touchedIndex]);
461
+ const onDragUpdate = (0, react_1.useCallback)((absoluteX, relativeY, velocityX, velocityY, startIndex) => {
462
+ 'worklet';
463
+ if (phase.value === 'inflating')
464
+ phase.value = 'dragging';
465
+ const rawCenter = absoluteX - shellScreenLeft - grabOffsetX.value;
466
+ const baseHalf = lensWidth / 2;
467
+ const minCenter = baseHalf;
468
+ const maxCenter = barWidth - baseHalf;
469
+ let center = rawCenter;
470
+ if (center < minCenter)
471
+ center = minCenter + (center - minCenter) * 0.2;
472
+ if (center > maxCenter)
473
+ center = maxCenter + (center - maxCenter) * 0.2;
474
+ center = Math.max(minCenter - 16, Math.min(maxCenter + 16, center));
475
+ let nearestIndex = 0;
476
+ let nearestDistance = Number.MAX_VALUE;
477
+ for (let index = 0; index < itemCount; index += 1) {
478
+ const tabCenter = horizontalPadding + itemWidth * (index + 0.5);
479
+ const distance = Math.abs(center - tabCenter);
480
+ if (distance < nearestDistance) {
481
+ nearestIndex = index;
482
+ nearestDistance = distance;
483
+ }
484
+ }
485
+ hoveredIndex.value = nearestIndex;
486
+ const magneticRange = Math.max(itemWidth * 0.9, 1);
487
+ const magneticStrength = 0.075 * (1 - Math.min(nearestDistance / magneticRange, 1));
488
+ center += (horizontalPadding + itemWidth * (nearestIndex + 0.5) - center) * magneticStrength;
489
+ const speed = Math.min(Math.abs(velocityX) / 1800, 1);
490
+ const stretch = reducedMotion ? 0 : speed * 16;
491
+ const activeWidth = lensWidth + (reducedMotion ? 0 : 20) + stretch;
492
+ const direction = velocityX > 28 ? 1 : velocityX < -28 ? -1 : 0;
493
+ const leadingExtra = stretch * 0.62;
494
+ const trailingExtra = stretch * 0.14;
495
+ const targetLeft = center - activeWidth / 2 - (direction < 0 ? leadingExtra : trailingExtra);
496
+ const targetRight = center + activeWidth / 2 + (direction > 0 ? leadingExtra : trailingExtra);
497
+ const yOffset = reducedMotion ? 0 : Math.max(-8, Math.min(8, relativeY - height / 2));
498
+ dragVelocityX.value = velocityX;
499
+ dragVelocityY.value = velocityY;
500
+ lensOffsetY.value = yOffset;
501
+ lensHeight.value = lensBaseHeight + interactionProgress.value * 10 - (reducedMotion ? 0 : speed * 3);
502
+ // Keep the leading edge locked to the finger. Only the trailing edge
503
+ // chases it with a spring, so the lens translates continuously while
504
+ // still stretching like a viscous surface.
505
+ if (direction > 0) {
506
+ lensRight.value = targetRight;
507
+ lensLeft.value = (0, react_native_reanimated_1.withSpring)(targetLeft, EDGE_SPRING_SLOW);
508
+ }
509
+ else if (direction < 0) {
510
+ lensLeft.value = targetLeft;
511
+ lensRight.value = (0, react_native_reanimated_1.withSpring)(targetRight, EDGE_SPRING_SLOW);
512
+ }
513
+ else {
514
+ lensLeft.value = (0, react_native_reanimated_1.withSpring)(targetLeft, IDLE_SPRING);
515
+ lensRight.value = (0, react_native_reanimated_1.withSpring)(targetRight, IDLE_SPRING);
516
+ }
517
+ const hapticIndex = nearestDistance < itemWidth * 0.36 && nearestIndex !== startIndex ? nearestIndex : -1;
518
+ if (hapticIndex !== lastHapticIndex.value) {
519
+ lastHapticIndex.value = hapticIndex;
520
+ if (hapticIndex >= 0)
521
+ (0, react_native_reanimated_1.runOnJS)(emitTargetHaptic)(hapticIndex);
522
+ }
523
+ }, [barWidth, dragVelocityX, dragVelocityY, grabOffsetX, height, horizontalPadding, hoveredIndex, interactionProgress, itemCount, itemWidth, lastHapticIndex, lensBaseHeight, lensHeight, lensLeft, lensRight, lensWidth, phase, reducedMotion, shellScreenLeft, lensOffsetY]);
524
+ const onBeginSnap = (0, react_1.useCallback)((velocityX, startIndex, cancelled = false) => {
525
+ 'worklet';
526
+ if (snapStarted.value || (phase.value !== 'inflating' && phase.value !== 'dragging'))
527
+ return;
528
+ snapStarted.value = true;
529
+ phase.value = 'snapping';
530
+ const originIndex = cancelled ? startIndex : originSelectedIndex.value;
531
+ const currentCenter = (lensLeft.value + lensRight.value) / 2;
532
+ const projectedCenter = currentCenter + velocityX * 0.075;
533
+ let targetIndex = 0;
534
+ let nearestDistance = Number.MAX_VALUE;
535
+ if (cancelled) {
536
+ targetIndex = originIndex;
537
+ }
538
+ else {
539
+ for (let index = 0; index < itemCount; index += 1) {
540
+ const tabCenter = horizontalPadding + itemWidth * (index + 0.5);
541
+ const distance = Math.abs(projectedCenter - tabCenter);
542
+ if (distance < nearestDistance) {
543
+ nearestDistance = distance;
544
+ targetIndex = index;
545
+ }
546
+ }
547
+ }
548
+ const targetCenter = horizontalPadding + itemWidth * (targetIndex + 0.5);
549
+ const targetLeft = targetCenter - lensWidth / 2;
550
+ pendingIndex.value = targetIndex;
551
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('SNAP_START', `target=${targetIndex}${cancelled ? ' rollback' : ''}`);
552
+ // Page ownership changes as soon as the finger is released and the
553
+ // destination is known. The glass snap/settle continues independently,
554
+ // so navigation never waits for the trailing spring to finish.
555
+ if (!cancelled && targetIndex !== originIndex) {
556
+ (0, react_native_reanimated_1.runOnJS)(commitDragSelection)(targetIndex, originIndex);
557
+ }
558
+ lensOffsetY.value = (0, react_native_reanimated_1.withSpring)(0, { damping: 24, stiffness: 300 });
559
+ lensHeight.value = reducedMotion
560
+ ? (0, react_native_reanimated_1.withTiming)(lensBaseHeight, { duration: 100 })
561
+ : (0, react_native_reanimated_1.withSpring)(lensBaseHeight, { damping: 25, stiffness: 320, mass: 0.7 });
562
+ const finishSnap = (finished) => {
563
+ 'worklet';
564
+ if (phase.value !== 'snapping')
565
+ return;
566
+ if (!finished) {
567
+ resetInteractionOnUI(originIndex);
568
+ return;
569
+ }
570
+ phase.value = 'settling';
571
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('SNAP_END', `target=${targetIndex}`);
572
+ interactionProgress.value = (0, react_native_reanimated_1.withTiming)(0, { duration: reducedMotion ? 95 : 145 }, (settled) => {
573
+ if (settled) {
574
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('SETTLE_END');
575
+ resetInteractionOnUI(targetIndex);
576
+ }
577
+ else {
578
+ resetInteractionOnUI(originIndex);
579
+ }
580
+ });
581
+ };
582
+ if (reducedMotion) {
583
+ lensLeft.value = (0, react_native_reanimated_1.withTiming)(targetLeft, { duration: 120 });
584
+ // One trailing edge owns completion. This avoids a two-callback
585
+ // counter getting stranded if either independent animation cancels.
586
+ lensRight.value = (0, react_native_reanimated_1.withTiming)(targetLeft + lensWidth, { duration: 120 }, finishSnap);
587
+ }
588
+ else {
589
+ // The trailing edge is the sole completion signal. It uses the
590
+ // slower spring, while the leading edge reaches the target first.
591
+ const wasMovingRight = velocityX >= 0;
592
+ lensLeft.value = (0, react_native_reanimated_1.withSpring)(targetLeft, wasMovingRight ? EDGE_SPRING_SLOW : EDGE_SPRING_FAST, wasMovingRight ? finishSnap : undefined);
593
+ lensRight.value = (0, react_native_reanimated_1.withSpring)(targetLeft + lensWidth, wasMovingRight ? EDGE_SPRING_FAST : EDGE_SPRING_SLOW, wasMovingRight ? undefined : finishSnap);
594
+ }
595
+ }, [commitDragSelection, horizontalPadding, interactionProgress, itemCount, itemWidth, lensBaseHeight, lensHeight, lensLeft, lensOffsetY, lensRight, lensWidth, originSelectedIndex, pendingIndex, phase, reducedMotion, resetInteractionOnUI, snapStarted]);
596
+ const tabBarGesture = react_1.default.useMemo(() => react_native_gesture_handler_1.Gesture.Pan()
597
+ // Horizontal controls must not steal vertical drags: without this the
598
+ // parent page stops scrolling whenever the finger lands on the control.
599
+ .activeOffsetX([-8, 8])
600
+ .failOffsetY([-16, 16])
601
+ .manualActivation(true)
602
+ .shouldCancelWhenOutside(false)
603
+ .maxPointers(1)
604
+ .onTouchesDown((event, manager) => {
605
+ 'worklet';
606
+ const touch = event.changedTouches[0] ?? event.allTouches[0];
607
+ if (!touch) {
608
+ manager.fail();
609
+ return;
610
+ }
611
+ (0, react_native_reanimated_1.runOnJS)(noteGestureDown)();
612
+ if (touchSessionActive.value || phase.value !== 'idle') {
613
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('INTERACTION_DOWN_BLOCKED', `phase=${phase.value}`);
614
+ manager.fail();
615
+ return;
616
+ }
617
+ const localX = touch.absoluteX - shellScreenLeft;
618
+ const rawIndex = Math.floor((localX - horizontalPadding) / Math.max(itemWidth, 1));
619
+ const hitIndex = Math.max(0, Math.min(itemCount - 1, rawIndex));
620
+ const nextSessionId = sessionId.value + 1;
621
+ sessionId.value = nextSessionId;
622
+ touchSessionActive.value = true;
623
+ touchMovedPastSlop.value = false;
624
+ touchedIndex.value = hitIndex;
625
+ touchStartX.value = touch.absoluteX;
626
+ touchStartY.value = touch.absoluteY;
627
+ originSelectedIndex.value = selected;
628
+ hoveredIndex.value = hitIndex;
629
+ pendingIndex.value = hitIndex;
630
+ holdCandidate.value = hitIndex === selected;
631
+ holdActivated.value = false;
632
+ panActivated.value = false;
633
+ panActivationRequested.value = false;
634
+ panUpdateLogged.value = false;
635
+ snapStarted.value = false;
636
+ interactionActive.value = false;
637
+ lastHapticIndex.value = -1;
638
+ phase.value = 'pressing';
639
+ manager.begin();
640
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('INTERACTION_DOWN', `hit=${hitIndex} selected=${selected}`);
641
+ if (hitIndex === selected) {
642
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('HOLD_BEGIN', `index=${selected}`);
643
+ holdTimerProgress.value = (0, react_native_reanimated_1.withDelay)(LONG_PRESS_THRESHOLD_MS, (0, react_native_reanimated_1.withTiming)(1, { duration: 1 }, (finished) => {
644
+ if (finished)
645
+ activateHoldOnUI(nextSessionId, selected);
646
+ }));
647
+ }
648
+ })
649
+ .onTouchesMove((event, manager) => {
650
+ 'worklet';
651
+ if (!touchSessionActive.value)
652
+ return;
653
+ const touch = event.changedTouches[0] ?? event.allTouches[0];
654
+ if (!touch)
655
+ return;
656
+ const dx = touch.absoluteX - touchStartX.value;
657
+ const dy = touch.absoluteY - touchStartY.value;
658
+ const distanceSquared = dx * dx + dy * dy;
659
+ if (!holdActivated.value) {
660
+ if (Math.abs(dy) > Math.abs(dx) && distanceSquared > PRE_HOLD_SLOP * PRE_HOLD_SLOP) {
661
+ touchMovedPastSlop.value = true;
662
+ holdCandidate.value = false;
663
+ (0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
664
+ holdTimerProgress.value = 0;
665
+ manager.fail();
666
+ return;
667
+ }
668
+ if (holdCandidate.value && Math.abs(dx) >= DRAG_START_SLOP && Math.abs(dx) >= Math.abs(dy) * 1.25) {
669
+ (0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
670
+ holdTimerProgress.value = 0;
671
+ activateHoldOnUI(sessionId.value, originSelectedIndex.value);
672
+ if (holdActivated.value) {
673
+ panActivationRequested.value = true;
674
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_REQUEST_ACTIVATE', 'immediate');
675
+ manager.activate();
676
+ }
677
+ return;
678
+ }
679
+ if (!holdCandidate.value && distanceSquared > PRE_HOLD_SLOP * PRE_HOLD_SLOP) {
680
+ touchMovedPastSlop.value = true;
681
+ (0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
682
+ holdTimerProgress.value = 0;
683
+ manager.fail();
684
+ }
685
+ return;
686
+ }
687
+ if (distanceSquared >= DRAG_START_SLOP * DRAG_START_SLOP && !panActivationRequested.value) {
688
+ panActivationRequested.value = true;
689
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_REQUEST_ACTIVATE');
690
+ manager.activate();
691
+ }
692
+ })
693
+ .onTouchesUp((event, manager) => {
694
+ 'worklet';
695
+ if (!touchSessionActive.value)
696
+ return;
697
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('RELEASE');
698
+ (0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
699
+ holdTimerProgress.value = 0;
700
+ if (panActivated.value) {
701
+ // Pan's normal END event owns snap/commit after activation.
702
+ touchSessionActive.value = false;
703
+ return;
704
+ }
705
+ const touch = event.changedTouches[0] ?? event.allTouches[0];
706
+ const localX = touch ? touch.absoluteX - shellScreenLeft : touchStartX.value - shellScreenLeft;
707
+ const rawIndex = Math.floor((localX - horizontalPadding) / Math.max(itemWidth, 1));
708
+ const releaseIndex = Math.max(0, Math.min(itemCount - 1, rawIndex));
709
+ const origin = originSelectedIndex.value;
710
+ const didHold = holdActivated.value;
711
+ const wasCancelledByMovement = touchMovedPastSlop.value;
712
+ touchSessionActive.value = false;
713
+ if (didHold) {
714
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('HOLD_RELEASE', 'without_drag');
715
+ onBeginSnap(0, origin, true);
716
+ }
717
+ else if (!wasCancelledByMovement) {
718
+ phase.value = 'idle';
719
+ holdCandidate.value = false;
720
+ holdActivated.value = false;
721
+ interactionActive.value = false;
722
+ touchedIndex.value = releaseIndex;
723
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('TAP', `target=${releaseIndex}`);
724
+ (0, react_native_reanimated_1.runOnJS)(onSelect)(releaseIndex);
725
+ }
726
+ manager.fail();
727
+ })
728
+ .onStart(() => {
729
+ 'worklet';
730
+ if (!holdActivated.value || phase.value !== 'inflating')
731
+ return;
732
+ panActivated.value = true;
733
+ phase.value = 'dragging';
734
+ // Keep the finger offset captured when the hold inflated the lens;
735
+ // that preserves the initial 3dp of movement instead of jumping.
736
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_ACTIVE');
737
+ })
738
+ .onUpdate((event) => {
739
+ 'worklet';
740
+ if (phase.value !== 'dragging')
741
+ return;
742
+ if (!panUpdateLogged.value) {
743
+ panUpdateLogged.value = true;
744
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_UPDATE_FIRST');
745
+ }
746
+ onDragUpdate(event.absoluteX, event.y, event.velocityX, event.velocityY, originSelectedIndex.value);
747
+ })
748
+ .onEnd((event, success) => {
749
+ 'worklet';
750
+ if (!success || !panActivated.value)
751
+ return;
752
+ touchSessionActive.value = false;
753
+ (0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
754
+ holdTimerProgress.value = 0;
755
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_END');
756
+ onBeginSnap(event.velocityX, originSelectedIndex.value, false);
757
+ })
758
+ .onFinalize((_event, success) => {
759
+ 'worklet';
760
+ if (success)
761
+ return;
762
+ (0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
763
+ holdTimerProgress.value = 0;
764
+ touchSessionActive.value = false;
765
+ if (phase.value === 'pressing') {
766
+ resetInteractionOnUI(originSelectedIndex.value);
767
+ }
768
+ else if (phase.value === 'inflating' || phase.value === 'dragging') {
769
+ (0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_END', 'cancel');
770
+ onBeginSnap(0, originSelectedIndex.value, true);
771
+ }
772
+ }), [activateHoldOnUI, horizontalPadding, holdActivated, holdCandidate, holdTimerProgress, interactionActive, itemCount, itemWidth, lastHapticIndex, noteGestureDown, onBeginSnap, onDragUpdate, onSelect, originSelectedIndex, panActivated, panActivationRequested, panUpdateLogged, pendingIndex, phase, resetInteractionOnUI, selected, sessionId, shellScreenLeft, snapStarted, touchMovedPastSlop, touchSessionActive, touchStartX, touchStartY, touchedIndex, hoveredIndex]);
773
+ const localLensStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
774
+ const width = Math.max(lensRight.value - lensLeft.value, 1);
775
+ const center = (lensLeft.value + lensRight.value) / 2;
776
+ return {
777
+ borderRadius: Math.min(lensHeight.value, width) / 2,
778
+ transform: [
779
+ { translateX: center - selectedCenterX },
780
+ { translateY: lensOffsetY.value },
781
+ { scaleX: width / lensWidth },
782
+ { scaleY: lensHeight.value / lensBaseHeight },
783
+ ],
784
+ };
785
+ }, [lensBaseHeight, lensWidth, selectedCenterX]);
786
+ const liveLensStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
787
+ left: lensLeft.value,
788
+ top: (height - lensHeight.value) / 2 + lensOffsetY.value,
789
+ width: Math.max(lensRight.value - lensLeft.value, 1),
790
+ height: lensHeight.value,
791
+ borderRadius: Math.min(lensHeight.value, lensRight.value - lensLeft.value) / 2,
792
+ }), [height]);
793
+ const liveLensAnimatedProps = (0, react_native_reanimated_1.useAnimatedProps)(() => ({
794
+ interactionProgress: interactionProgress.value,
795
+ motionX: Math.max(-1, Math.min(1, dragVelocityX.value / 1800)),
796
+ motionY: Math.max(-1, Math.min(1, dragVelocityY.value / 1800)),
797
+ }));
798
+ const renderVisual = renderItem ?? renderIcon ?? ((item) => item.label);
799
+ const renderTabItems = (sampled = false) => items.map((item, index) => ((0, jsx_runtime_1.jsx)(GlassTabItem, { item: item, index: index, selected: index === selected, itemWidth: itemWidth, horizontalPadding: horizontalPadding, barHeight: height, renderVisual: renderVisual, customContent: renderItem != null, sampled: sampled, lensLeft: lensLeft, lensRight: lensRight }, `${item.label}-${index}`)));
800
+ const tabItems = renderTabItems();
801
+ const accessibilityTargets = items.map((item, index) => ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessible: true, accessibilityRole: "tab", accessibilityLabel: item.label, accessibilityHint: accessibilityHint ?? '长按并拖动当前选中页签可切换页面', accessibilityState: { selected: index === selected }, accessibilityActions: [{ name: 'activate', label: item.label }], onAccessibilityAction: () => onSelect(index), style: styles.interactionTarget }, `tab-accessibility-${item.label}-${index}`)));
802
+ const resolvedShellRadius = shellRadius ?? height / 2;
803
+ const shellMaterial = {
804
+ opticsModel: 'referenceParity',
805
+ referenceDepthEffect: true,
806
+ radius: resolvedShellRadius,
807
+ surfaceColor: { light: shellSurfaceColor, dark: shellSurfaceColor },
808
+ blurRadius: tabBarMaterial?.blurRadius ?? 8,
809
+ refractionHeight: tabBarMaterial?.refractionHeight ?? 24,
810
+ refractionAmount: tabBarMaterial?.refractionAmount ?? -24,
811
+ saturation: tabBarMaterial?.saturation ?? 1.5,
812
+ chromaticAberration: 0,
813
+ highlightAlpha: 0.5,
814
+ highlightWidth: 0.5,
815
+ };
816
+ const shellStyle = {
817
+ width: barWidth,
818
+ height,
819
+ borderRadius: resolvedShellRadius,
820
+ borderColor: shellBorderColor,
821
+ backgroundColor: 'transparent',
822
+ shadowColor: shellShadowColor,
823
+ shadowOpacity: tabBarMaterial?.shadowOpacity ?? 0,
824
+ shadowRadius: tabBarMaterial?.shadowRadius ?? 0,
825
+ shadowOffset: { width: 0, height: tabBarMaterial?.shadowOffsetY ?? 0 },
826
+ elevation: tabBarMaterial?.elevation ?? 0,
827
+ };
828
+ const barContents = ((0, jsx_runtime_1.jsxs)(react_native_1.View, { ref: inlineHostRef, onLayout: presentation === 'inline' && typeof requestedWidth !== 'number'
829
+ ? (event) => {
830
+ setInlineWidth(event.nativeEvent.layout.width);
831
+ inlineHostRef.current?.measureInWindow((left) => setInlineScreenLeft(left));
832
+ }
833
+ : undefined, pointerEvents: "box-none", style: presentation === 'floating'
834
+ ? [styles.host, { left: shellScreenLeft, bottom: bottomInset + TAB_BAR_BOTTOM_GAP, width: barWidth, height }]
835
+ : [styles.inlineHost, { width: requestedWidth ?? '100%', height }], children: [nativeLiveAvailable ? ((0, jsx_runtime_1.jsx)(GlassSurface_1.RouteGlassCaptureScope, { scopeId: tabScopeId, children: (0, jsx_runtime_1.jsx)(TabLensScene, { children: (tabSceneProviderId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GlassSurface_1.RouteGlassCaptureSource, { captureMode: liveBackdropEnabled ? 'livePassThrough' : 'oneShotPassThrough', underlayProviderId: samplingProviderId, sourceRevision: `${dark}:${barWidth}:${height}:${items.map((item) => item.label).join('|')}`, style: react_native_1.StyleSheet.absoluteFill, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { pointerEvents: "none", style: [styles.shell, shellStyle], children: [(0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "tabBarShell", positioning: "inFlow", sampling: presentation === 'inline' ? 'local' : 'backdrop', providerIdOverride: samplingProviderId, inlineBackdrop: true, pointerEvents: "none", materialOverrides: shellMaterial, style: [react_native_1.StyleSheet.absoluteFill, { borderRadius: resolvedShellRadius }] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [styles.row, { paddingHorizontal: horizontalPadding }], children: renderTabItems(true) })] }) }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { pointerEvents: "none", style: [styles.shell, shellStyle], children: [(0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "tabBarShell", frameOverride: shellFrameOverride, positioning: "inFlow",
836
+ // An inline bar lives inside the page's own route capture
837
+ // source, so sampling that scene makes the capture
838
+ // include the surface being captured. On the User page
839
+ // that cycle drove RenderNode::prepareTreeImpl into a
840
+ // stack overflow. Inline bars sample locally instead.
841
+ sampling: presentation === 'inline' ? 'local' : 'backdrop', samplingSource: "routeScene", providerIdOverride: samplingProviderId, inlineBackdrop: true, pointerEvents: "none", materialOverrides: shellMaterial, style: [react_native_1.StyleSheet.absoluteFill, { borderRadius: resolvedShellRadius }] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [styles.row, { paddingHorizontal: horizontalPadding }], children: tabItems })] }), (0, jsx_runtime_1.jsx)(NativeGlassSurface, { pointerEvents: "none", providerId: tabSceneProviderId, opticsModel: appearance?.tokens.materials.tabSelectionLens.opticsModel, highlightStyle: appearance?.tokens.materials.tabSelectionLens.referenceHighlightStyle, interactionProfile: "tab", surfaceColor: appearance?.tokens.materials.tabSelectionLens.surfaceColor?.[dark ? 'dark' : 'light'], cornerRadius: appearance?.tokens.materials.tabSelectionLens.radius ?? lensBaseHeight / 2, blurRadius: (appearance?.tokens.materials.tabSelectionLens.blurRadius ?? 0.35) * (appearance?.tokens.materials.tabSelectionLens.opticsModel === 'referenceParity' ? 1 : appearance?.tokens.quality === 'high' ? 1.2 : 1), refractionHeight: lensRefractionHeight ?? appearance?.tokens.materials.tabSelectionLens.refractionHeight ?? 12, refractionAmount: appearance?.tokens.materials.tabSelectionLens.refractionAmount ?? 5.5, bodyRefractionAmount: appearance?.tokens.materials.tabSelectionLens.refractionBodyAmount ?? 1.5, saturation: appearance?.tokens.materials.tabSelectionLens.saturation ?? 1.02, chromaticAberration: appearance?.tokens.materials.tabSelectionLens.chromaticAberration ?? 0.3, highlightAlpha: appearance?.tokens.materials.tabSelectionLens.highlightAlpha ?? 0.62, highlightWidth: appearance?.tokens.materials.tabSelectionLens.highlightWidth ?? 1.3, tintAlpha: appearance?.tokens.materials.tabSelectionLens.tintAlpha ?? 0.08, specularStrength: appearance?.tokens.materials.tabSelectionLens.specularStrength ?? 0.95, fresnelStrength: appearance?.tokens.materials.tabSelectionLens.fresnelStrength ?? 0.72, innerShadowStrength: appearance?.tokens.materials.tabSelectionLens.innerShadowStrength ?? 0.2, shadowOpacity: appearance?.tokens.materials.tabSelectionLens.shadowOpacity ?? 0.05, shadowRadius: appearance?.tokens.materials.tabSelectionLens.shadowRadius ?? 4, shadowOffsetY: appearance?.tokens.materials.tabSelectionLens.shadowOffsetY ?? 4 / 6, tint: appearance?.tokens.tint[dark ? 'dark' : 'light'], continuous: liveBackdropEnabled, animatedProps: liveLensAnimatedProps, style: [styles.nativeLens, liveLensStyle] })] })) }) })) : ((0, jsx_runtime_1.jsxs)(react_native_1.View, { pointerEvents: "none", style: [styles.shell, shellStyle], children: [(0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "tabBarShell", frameOverride: shellFrameOverride, positioning: "inFlow", sampling: "backdrop", samplingSource: "routeScene", inlineBackdrop: true, pointerEvents: "none", materialOverrides: shellMaterial, style: [react_native_1.StyleSheet.absoluteFill, { borderRadius: resolvedShellRadius }] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [styles.row, { paddingHorizontal: horizontalPadding }], children: tabItems }), (0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "tabSelectionLens", positioning: "inFlow", sampling: "backdrop", samplingSource: "routeScene", inlineBackdrop: true, pointerEvents: "none", style: {
842
+ position: 'absolute',
843
+ left: selectedLeft,
844
+ top: verticalInset,
845
+ width: lensWidth,
846
+ height: lensBaseHeight,
847
+ borderRadius: lensBaseHeight / 2,
848
+ zIndex: 2,
849
+ }, animatedStyle: localLensStyle })] })), GESTURE_DEBUG_ENABLED && ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.gestureDebugOverlay, { width: Math.max(barWidth, TAB_BAR_MIN_WIDTH) }], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.gestureDebugText, children: `view DOWN ${gestureDebug.touchCount} · gesture DOWN ${gestureDebug.gestureCount}\nphase ${gestureDebug.phase} · hold candidate ${gestureDebug.holdCandidate ? 'ON' : 'off'} · hold ${gestureDebug.holdActivated ? 'ON' : 'off'} · drag ${gestureDebug.dragging ? 'ON' : 'off'} · snap ${gestureDebug.snapStarted ? 'ON' : 'off'}\norigin ${gestureDebug.origin} · hovered ${gestureDebug.hovered} · pending ${gestureDebug.pending}` }) })), (0, jsx_runtime_1.jsx)(react_native_gesture_handler_1.GestureDetector, { gesture: tabBarGesture, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "auto", onTouchStart: GESTURE_DEBUG_ENABLED ? noteTabViewTouch : undefined, collapsable: false, style: [styles.interactionLayer, { width: barWidth, height }], children: accessibilityTargets }) })] }));
850
+ return presentation === 'floating'
851
+ ? (0, jsx_runtime_1.jsx)(GlassSurface_1.GlassOverlay, { zIndex: TAB_BAR_PORTAL_Z_INDEX + 1, children: barContents })
852
+ : barContents;
853
+ }
854
+ // Floating overlays mount in the host's context, outside the calling page's
855
+ // capture scope. Resolve the id here so source and lens share that actual scope.
856
+ function TabLensScene({ children }) {
857
+ const providerId = (0, GlassSurface_1.useGlassSamplingProviderId)('routeScene');
858
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children(providerId ?? '') });
859
+ }
860
+ function GlassTabItem({ item, index, selected, itemWidth, horizontalPadding, barHeight, renderVisual, customContent, sampled = false, lensLeft, lensRight, }) {
861
+ const itemFocusStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
862
+ const center = (lensLeft.value + lensRight.value) / 2;
863
+ const tabCenter = horizontalPadding + itemWidth * (index + 0.5);
864
+ const strength = Math.max(0, Math.min(1, 1 - Math.abs(center - tabCenter) / Math.max(itemWidth * 0.92, 1)));
865
+ return {
866
+ transform: [{ scale: 1 + strength * 0.025 }],
867
+ };
868
+ }, [horizontalPadding, index, itemWidth]);
869
+ const activeIconStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
870
+ const center = (lensLeft.value + lensRight.value) / 2;
871
+ const tabCenter = horizontalPadding + itemWidth * (index + 0.5);
872
+ const strength = Math.max(0, Math.min(1, 1 - Math.abs(center - tabCenter) / Math.max(itemWidth * 0.92, 1)));
873
+ return { opacity: strength };
874
+ }, [horizontalPadding, index, itemWidth]);
875
+ const baseVisual = renderVisual(item, index, sampled);
876
+ const activeVisual = sampled ? null : renderVisual(item, index, true);
877
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.item, { height: barHeight }], children: (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [customContent ? styles.itemContentInline : styles.itemContent, itemFocusStyle], children: customContent ? ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.customContent, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.baseIcon, children: baseVisual }), (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "none", accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.customActive, activeIconStyle], children: activeVisual })] })) : ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.icon, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.baseIcon, children: baseVisual }), (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "none", style: [styles.activeIcon, activeIconStyle], children: activeVisual })] })) }) }));
878
+ }
879
+ const styles = react_native_1.StyleSheet.create({
880
+ host: {
881
+ position: 'absolute',
882
+ zIndex: 1,
883
+ },
884
+ inlineHost: {
885
+ position: 'relative',
886
+ alignSelf: 'stretch',
887
+ zIndex: 1,
888
+ },
889
+ interactionLayer: {
890
+ ...react_native_1.StyleSheet.flatten(react_native_1.StyleSheet.absoluteFill),
891
+ flexDirection: 'row',
892
+ zIndex: 100,
893
+ elevation: 100,
894
+ backgroundColor: 'transparent',
895
+ },
896
+ interactionTarget: {
897
+ flex: 1,
898
+ minWidth: 44,
899
+ minHeight: 44,
900
+ backgroundColor: 'transparent',
901
+ },
902
+ nativeLens: {
903
+ position: 'absolute',
904
+ zIndex: 2,
905
+ elevation: 8,
906
+ backgroundColor: 'transparent',
907
+ overflow: 'hidden',
908
+ },
909
+ gestureDebugOverlay: {
910
+ position: 'absolute',
911
+ left: 0,
912
+ top: -46,
913
+ zIndex: 99,
914
+ elevation: 99,
915
+ alignSelf: 'flex-start',
916
+ paddingHorizontal: 8,
917
+ paddingVertical: 5,
918
+ borderRadius: 6,
919
+ backgroundColor: 'rgba(12, 18, 28, 0.86)',
920
+ },
921
+ gestureDebugText: {
922
+ color: '#FFFFFF',
923
+ fontSize: 10,
924
+ lineHeight: 13,
925
+ fontVariant: ['tabular-nums'],
926
+ },
927
+ shell: {
928
+ overflow: 'hidden',
929
+ borderWidth: react_native_1.StyleSheet.hairlineWidth,
930
+ },
931
+ row: {
932
+ ...react_native_1.StyleSheet.flatten(react_native_1.StyleSheet.absoluteFill),
933
+ flexDirection: 'row',
934
+ alignItems: 'center',
935
+ paddingHorizontal: TAB_BAR_HORIZONTAL_PADDING,
936
+ position: 'relative',
937
+ zIndex: 1,
938
+ elevation: 1,
939
+ },
940
+ item: {
941
+ flex: 1,
942
+ minWidth: 44,
943
+ minHeight: 44,
944
+ alignItems: 'center',
945
+ justifyContent: 'center',
946
+ },
947
+ itemContent: {
948
+ alignItems: 'center',
949
+ justifyContent: 'center',
950
+ gap: 3,
951
+ },
952
+ icon: {
953
+ height: 25,
954
+ minWidth: 26,
955
+ alignItems: 'center',
956
+ justifyContent: 'center',
957
+ },
958
+ baseIcon: { alignItems: 'center', justifyContent: 'center' },
959
+ activeIcon: { ...react_native_1.StyleSheet.flatten(react_native_1.StyleSheet.absoluteFill), alignItems: 'center', justifyContent: 'center' },
960
+ itemContentInline: {
961
+ flex: 1,
962
+ width: '100%',
963
+ alignItems: 'center',
964
+ justifyContent: 'center',
965
+ },
966
+ customContent: {
967
+ alignItems: 'center',
968
+ justifyContent: 'center',
969
+ },
970
+ customActive: {
971
+ ...react_native_1.StyleSheet.flatten(react_native_1.StyleSheet.absoluteFill),
972
+ alignItems: 'center',
973
+ justifyContent: 'center',
974
+ },
975
+ });
976
+ //# sourceMappingURL=GlassTabBar.js.map