@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.
- package/LICENSE +21 -0
- package/README.md +307 -2
- package/README.zh-CN.md +310 -0
- package/THIRD_PARTY_NOTICES.md +98 -0
- package/android/build.gradle +19 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/expo/modules/localglass/ExpoLocalGlassEngineModule.kt +141 -0
- package/android/src/main/java/expo/modules/localglass/ExpoLocalGlassModule.kt +341 -0
- package/android/src/main/java/expo/modules/localglass/LocalGlassShader.kt +59 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/CoreLiquidGlassRegistry.kt +75 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/EffectiveScrollInputBridge.kt +47 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/ExpoGlassCoreModule.kt +226 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/ExpoGlassProviderCoreView.kt +1125 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/ExpoGlassSurfaceCoreView.kt +571 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/PassSurfaceSuppression.kt +39 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/SharedGlassPassProbeLog.kt +23 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/SharedGlassPassWiring.kt +59 -0
- package/android-core/build.gradle +36 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/BackdropRecorder.kt +930 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/FrozenBackdrop.kt +66 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassBackdropCoordinator.kt +624 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassBackdropSourceHandle.kt +8 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassScrollSource.kt +13 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassViewController.kt +1605 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/LiquidGlassProviderLayout.kt +340 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/LiquidGlassView.kt +103 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/ReferenceSourceWindowPolicy.kt +13 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/StableSceneTexturePolicy.kt +43 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/internal/GlassViewRenderer.kt +1459 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/internal/ReferenceTabSampling.kt +15 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/internal/SharedSceneCapture.kt +163 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassCapabilities.kt +21 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassEngine.kt +131 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassMaterial.kt +89 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassMath.kt +131 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassOpticalInsets.kt +8 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassRenderTier.kt +54 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassShapePacker.kt +77 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassSurfaceState.kt +11 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassUniforms.kt +113 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/LiquidGlassShaders.kt +234 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/SharedGlassPass.kt +456 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/geometry/G2RoundedRectangle.kt +207 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/geometry/ReferenceG2MaskTexture.kt +334 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/HeightFieldGlassShader.kt +7 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceBackdropBlurShader.kt +58 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceGaussianDiscBackdropBlur.kt +42 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceGlassUniforms.kt +111 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceParityGlassShader.kt +613 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceParityMultiShapeShader.kt +128 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/SdfScaleLensShader.kt +144 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassHardwareLayerExperiment.kt +29 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassMaterial.kt +14 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassRenderer.kt +126 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassRuntimeShader.kt +50 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassShader.kt +59 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassView.kt +47 -0
- package/android-core/src/main/java/com/newhu/liquidglass/motion/GlassMotionDriver.kt +824 -0
- package/android-core/src/main/java/com/newhu/liquidglass/motion/GlassMotionState.kt +359 -0
- package/android-core/src/main/java/com/newhu/liquidglass/motion/PointerVelocityTracker.kt +109 -0
- package/android-core/src/main/java/com/newhu/liquidglass/motion/SpringSpec.kt +209 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/G2Corner.kt +194 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassMaterial.kt +250 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassOpticsShader.kt +696 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassParityProbe.kt +342 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassShapeGeometry.kt +317 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassUniformBinder.kt +308 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/PixelDiff.kt +363 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/ReferenceOptics.kt +568 -0
- package/android-core/src/main/java/com/newhu/liquidglass/rendering/GlassEngineSelection.kt +30 -0
- package/android-core/src/main/java/com/newhu/liquidglass/rendering/GlassSurfaceHost.kt +317 -0
- package/android-core/src/main/java/com/newhu/liquidglass/rendering/GlassSurfaceRenderer.kt +847 -0
- package/android-core/src/main/java/com/newhu/liquidglass/rendering/RetainedBackdropLayer.kt +83 -0
- package/android-core/src/main/java/com/newhu/liquidglass/scheduler/GlassFrameScheduler.kt +27 -0
- package/android-core/src/main/java/com/newhu/liquidglass/telemetry/EffectiveScrollFpsProbe.kt +965 -0
- package/android-core/src/main/java/com/newhu/liquidglass/telemetry/GlassTelemetry.kt +16 -0
- package/android-core/src/main/java/com/newhu/liquidglass/telemetry/LiquidGlassPerfTelemetry.kt +676 -0
- package/android-core/src/main/java/com/newhu/liquidglass/telemetry/LiquidGlassTrace.kt +30 -0
- package/android-core/src/main/java/com/newhu/liquidglass/telemetry/LocalGlassTelemetry.kt +55 -0
- package/app.plugin.js +25 -0
- package/docs/images/buttons.webp +0 -0
- package/docs/images/controls.webp +0 -0
- package/docs/images/tabs.webp +0 -0
- package/docs/publishing.md +84 -0
- package/expo-module.config.json +10 -0
- package/lib/commonjs/GlassSurface.js +832 -0
- package/lib/commonjs/GlassSurface.js.map +1 -0
- package/lib/commonjs/GlassTabBar.js +976 -0
- package/lib/commonjs/GlassTabBar.js.map +1 -0
- package/lib/commonjs/GlassTabLens.js +67 -0
- package/lib/commonjs/GlassTabLens.js.map +1 -0
- package/lib/commonjs/LiquidGlassProvider.js +40 -0
- package/lib/commonjs/LiquidGlassProvider.js.map +1 -0
- package/lib/commonjs/LocalGlassMaterial.js +194 -0
- package/lib/commonjs/LocalGlassMaterial.js.map +1 -0
- package/lib/commonjs/adaptiveLuminance.js +14 -0
- package/lib/commonjs/adaptiveLuminance.js.map +1 -0
- package/lib/commonjs/badgePalette.js +46 -0
- package/lib/commonjs/badgePalette.js.map +1 -0
- package/lib/commonjs/buttonGesturePolicy.js +22 -0
- package/lib/commonjs/buttonGesturePolicy.js.map +1 -0
- package/lib/commonjs/components/AdaptiveLuminance.js +20 -0
- package/lib/commonjs/components/AdaptiveLuminance.js.map +1 -0
- package/lib/commonjs/components/BottomSheet.js +222 -0
- package/lib/commonjs/components/BottomSheet.js.map +1 -0
- package/lib/commonjs/components/Button.js +20 -0
- package/lib/commonjs/components/Button.js.map +1 -0
- package/lib/commonjs/components/Card.js +206 -0
- package/lib/commonjs/components/Card.js.map +1 -0
- package/lib/commonjs/components/Checkbox.js +123 -0
- package/lib/commonjs/components/Checkbox.js.map +1 -0
- package/lib/commonjs/components/ControlPressContext.js +8 -0
- package/lib/commonjs/components/ControlPressContext.js.map +1 -0
- package/lib/commonjs/components/Dialog.js +122 -0
- package/lib/commonjs/components/Dialog.js.map +1 -0
- package/lib/commonjs/components/DialogAction.js +124 -0
- package/lib/commonjs/components/DialogAction.js.map +1 -0
- package/lib/commonjs/components/DialogContent.js +23 -0
- package/lib/commonjs/components/DialogContent.js.map +1 -0
- package/lib/commonjs/components/GlassButton.js +96 -0
- package/lib/commonjs/components/GlassButton.js.map +1 -0
- package/lib/commonjs/components/GlassFab.js +43 -0
- package/lib/commonjs/components/GlassFab.js.map +1 -0
- package/lib/commonjs/components/GlassMagnifier.js +135 -0
- package/lib/commonjs/components/GlassMagnifier.js.map +1 -0
- package/lib/commonjs/components/GlassPlayground.js +158 -0
- package/lib/commonjs/components/GlassPlayground.js.map +1 -0
- package/lib/commonjs/components/GlassSlider.js +364 -0
- package/lib/commonjs/components/GlassSlider.js.map +1 -0
- package/lib/commonjs/components/GlassSwitch.js +334 -0
- package/lib/commonjs/components/GlassSwitch.js.map +1 -0
- package/lib/commonjs/components/GlassTabBar.js +387 -0
- package/lib/commonjs/components/GlassTabBar.js.map +1 -0
- package/lib/commonjs/components/Input.js +180 -0
- package/lib/commonjs/components/Input.js.map +1 -0
- package/lib/commonjs/components/ListRow.js +64 -0
- package/lib/commonjs/components/ListRow.js.map +1 -0
- package/lib/commonjs/components/Menu.js +214 -0
- package/lib/commonjs/components/Menu.js.map +1 -0
- package/lib/commonjs/components/NavigationBar.js +20 -0
- package/lib/commonjs/components/NavigationBar.js.map +1 -0
- package/lib/commonjs/components/NumberWheel.js +273 -0
- package/lib/commonjs/components/NumberWheel.js.map +1 -0
- package/lib/commonjs/components/PageFeedList.js +25 -0
- package/lib/commonjs/components/PageFeedList.js.map +1 -0
- package/lib/commonjs/components/PageScaffold.js +161 -0
- package/lib/commonjs/components/PageScaffold.js.map +1 -0
- package/lib/commonjs/components/PreferenceGroup.js +34 -0
- package/lib/commonjs/components/PreferenceGroup.js.map +1 -0
- package/lib/commonjs/components/ProgressIndicator.js +79 -0
- package/lib/commonjs/components/ProgressIndicator.js.map +1 -0
- package/lib/commonjs/components/ProgressiveBlur.js +29 -0
- package/lib/commonjs/components/ProgressiveBlur.js.map +1 -0
- package/lib/commonjs/components/ReferenceSlider.js +304 -0
- package/lib/commonjs/components/ReferenceSlider.js.map +1 -0
- package/lib/commonjs/components/ReferenceTabBar.js +381 -0
- package/lib/commonjs/components/ReferenceTabBar.js.map +1 -0
- package/lib/commonjs/components/SearchBar.js +200 -0
- package/lib/commonjs/components/SearchBar.js.map +1 -0
- package/lib/commonjs/components/SegmentedControl.js +62 -0
- package/lib/commonjs/components/SegmentedControl.js.map +1 -0
- package/lib/commonjs/components/Slider.js +12 -0
- package/lib/commonjs/components/Slider.js.map +1 -0
- package/lib/commonjs/components/Snackbar.js +11 -0
- package/lib/commonjs/components/Snackbar.js.map +1 -0
- package/lib/commonjs/components/SurfaceEnvironmentContext.js +35 -0
- package/lib/commonjs/components/SurfaceEnvironmentContext.js.map +1 -0
- package/lib/commonjs/components/SurfaceGroup.js +39 -0
- package/lib/commonjs/components/SurfaceGroup.js.map +1 -0
- package/lib/commonjs/components/Switch.js +11 -0
- package/lib/commonjs/components/Switch.js.map +1 -0
- package/lib/commonjs/components/Toast.js +110 -0
- package/lib/commonjs/components/Toast.js.map +1 -0
- package/lib/commonjs/components/TopAppBar.js +107 -0
- package/lib/commonjs/components/TopAppBar.js.map +1 -0
- package/lib/commonjs/components/bottomSheetMotion.js +14 -0
- package/lib/commonjs/components/bottomSheetMotion.js.map +1 -0
- package/lib/commonjs/components/glassControlMaterial.js +22 -0
- package/lib/commonjs/components/glassControlMaterial.js.map +1 -0
- package/lib/commonjs/components/menuPosition.js +42 -0
- package/lib/commonjs/components/menuPosition.js.map +1 -0
- package/lib/commonjs/components/pages/FeedPage.js +15 -0
- package/lib/commonjs/components/pages/FeedPage.js.map +1 -0
- package/lib/commonjs/components/pages/PageBenchmarkContext.js +123 -0
- package/lib/commonjs/components/pages/PageBenchmarkContext.js.map +1 -0
- package/lib/commonjs/components/pages/SettingsPage.js +47 -0
- package/lib/commonjs/components/pages/SettingsPage.js.map +1 -0
- package/lib/commonjs/components/pages/SettingsSection.js +14 -0
- package/lib/commonjs/components/pages/SettingsSection.js.map +1 -0
- package/lib/commonjs/components/pages/StaticSettingsPage.js +16 -0
- package/lib/commonjs/components/pages/StaticSettingsPage.js.map +1 -0
- package/lib/commonjs/fallbackKnobGeometry.js +19 -0
- package/lib/commonjs/fallbackKnobGeometry.js.map +1 -0
- package/lib/commonjs/glassController.js +65 -0
- package/lib/commonjs/glassController.js.map +1 -0
- package/lib/commonjs/glassNativeEngine.js +16 -0
- package/lib/commonjs/glassNativeEngine.js.map +1 -0
- package/lib/commonjs/glassRuntime.js +27 -0
- package/lib/commonjs/glassRuntime.js.map +1 -0
- package/lib/commonjs/index.js +218 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/inputPresentation.js +17 -0
- package/lib/commonjs/inputPresentation.js.map +1 -0
- package/lib/commonjs/localGlassTelemetry.js +113 -0
- package/lib/commonjs/localGlassTelemetry.js.map +1 -0
- package/lib/commonjs/motion/MotionProvider.js +15 -0
- package/lib/commonjs/motion/MotionProvider.js.map +1 -0
- package/lib/commonjs/motion/easings.js +71 -0
- package/lib/commonjs/motion/easings.js.map +1 -0
- package/lib/commonjs/motion/folmeSpring.js +24 -0
- package/lib/commonjs/motion/folmeSpring.js.map +1 -0
- package/lib/commonjs/motion/folmeSpringByResponse.js +22 -0
- package/lib/commonjs/motion/folmeSpringByResponse.js.map +1 -0
- package/lib/commonjs/motion/index.js +57 -0
- package/lib/commonjs/motion/index.js.map +1 -0
- package/lib/commonjs/motion/presets.js +101 -0
- package/lib/commonjs/motion/presets.js.map +1 -0
- package/lib/commonjs/nativeGlassViews.js +33 -0
- package/lib/commonjs/nativeGlassViews.js.map +1 -0
- package/lib/commonjs/performanceTelemetry.js +28 -0
- package/lib/commonjs/performanceTelemetry.js.map +1 -0
- package/lib/commonjs/pointerEventBridge.js +17 -0
- package/lib/commonjs/pointerEventBridge.js.map +1 -0
- package/lib/commonjs/pointerGeometry.js +12 -0
- package/lib/commonjs/pointerGeometry.js.map +1 -0
- package/lib/commonjs/pressVelocity.js +34 -0
- package/lib/commonjs/pressVelocity.js.map +1 -0
- package/lib/commonjs/primitives/Divider.js +32 -0
- package/lib/commonjs/primitives/Divider.js.map +1 -0
- package/lib/commonjs/primitives/Icon.js +22 -0
- package/lib/commonjs/primitives/Icon.js.map +1 -0
- package/lib/commonjs/primitives/PressIndication.js +58 -0
- package/lib/commonjs/primitives/PressIndication.js.map +1 -0
- package/lib/commonjs/primitives/Pressable.js +28 -0
- package/lib/commonjs/primitives/Pressable.js.map +1 -0
- package/lib/commonjs/primitives/PressableScale.js +64 -0
- package/lib/commonjs/primitives/PressableScale.js.map +1 -0
- package/lib/commonjs/primitives/Surface.js +122 -0
- package/lib/commonjs/primitives/Surface.js.map +1 -0
- package/lib/commonjs/primitives/Text.js +43 -0
- package/lib/commonjs/primitives/Text.js.map +1 -0
- package/lib/commonjs/primitives/index.js +18 -0
- package/lib/commonjs/primitives/index.js.map +1 -0
- package/lib/commonjs/renderer.js +58 -0
- package/lib/commonjs/renderer.js.map +1 -0
- package/lib/commonjs/sliderValue.js +28 -0
- package/lib/commonjs/sliderValue.js.map +1 -0
- package/lib/commonjs/surfaceRendererPolicy.js +32 -0
- package/lib/commonjs/surfaceRendererPolicy.js.map +1 -0
- package/lib/commonjs/theme/ThemeProvider.js +37 -0
- package/lib/commonjs/theme/ThemeProvider.js.map +1 -0
- package/lib/commonjs/theme/buildTheme.js +157 -0
- package/lib/commonjs/theme/buildTheme.js.map +1 -0
- package/lib/commonjs/theme/glassColors.js +17 -0
- package/lib/commonjs/theme/glassColors.js.map +1 -0
- package/lib/commonjs/theme/index.js +38 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/liquidGlass.js +24 -0
- package/lib/commonjs/theme/liquidGlass.js.map +1 -0
- package/lib/commonjs/theme/presentation.js +14 -0
- package/lib/commonjs/theme/presentation.js.map +1 -0
- package/lib/commonjs/theme/registry.js +17 -0
- package/lib/commonjs/theme/registry.js.map +1 -0
- package/lib/commonjs/theme/selectVariant.js +13 -0
- package/lib/commonjs/theme/selectVariant.js.map +1 -0
- package/lib/commonjs/theme/tokens.js +266 -0
- package/lib/commonjs/theme/tokens.js.map +1 -0
- package/lib/commonjs/theme/types.js +3 -0
- package/lib/commonjs/theme/types.js.map +1 -0
- package/lib/commonjs/theme/wallpaper.js +91 -0
- package/lib/commonjs/theme/wallpaper.js.map +1 -0
- package/lib/commonjs/types.js +3 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/useButtonGesture.js +135 -0
- package/lib/commonjs/useButtonGesture.js.map +1 -0
- package/lib/commonjs/useGlassKnobMotion.js +115 -0
- package/lib/commonjs/useGlassKnobMotion.js.map +1 -0
- package/lib/commonjs/useGlassPressMotion.js +147 -0
- package/lib/commonjs/useGlassPressMotion.js.map +1 -0
- package/lib/module/GlassSurface.js +782 -0
- package/lib/module/GlassSurface.js.map +1 -0
- package/lib/module/GlassTabBar.js +939 -0
- package/lib/module/GlassTabBar.js.map +1 -0
- package/lib/module/GlassTabLens.js +64 -0
- package/lib/module/GlassTabLens.js.map +1 -0
- package/lib/module/LiquidGlassProvider.js +37 -0
- package/lib/module/LiquidGlassProvider.js.map +1 -0
- package/lib/module/LocalGlassMaterial.js +191 -0
- package/lib/module/LocalGlassMaterial.js.map +1 -0
- package/lib/module/adaptiveLuminance.js +11 -0
- package/lib/module/adaptiveLuminance.js.map +1 -0
- package/lib/module/badgePalette.js +40 -0
- package/lib/module/badgePalette.js.map +1 -0
- package/lib/module/buttonGesturePolicy.js +17 -0
- package/lib/module/buttonGesturePolicy.js.map +1 -0
- package/lib/module/components/AdaptiveLuminance.js +16 -0
- package/lib/module/components/AdaptiveLuminance.js.map +1 -0
- package/lib/module/components/BottomSheet.js +186 -0
- package/lib/module/components/BottomSheet.js.map +1 -0
- package/lib/module/components/Button.js +17 -0
- package/lib/module/components/Button.js.map +1 -0
- package/lib/module/components/Card.js +170 -0
- package/lib/module/components/Card.js.map +1 -0
- package/lib/module/components/Checkbox.js +84 -0
- package/lib/module/components/Checkbox.js.map +1 -0
- package/lib/module/components/ControlPressContext.js +4 -0
- package/lib/module/components/ControlPressContext.js.map +1 -0
- package/lib/module/components/Dialog.js +86 -0
- package/lib/module/components/Dialog.js.map +1 -0
- package/lib/module/components/DialogAction.js +88 -0
- package/lib/module/components/DialogAction.js.map +1 -0
- package/lib/module/components/DialogContent.js +20 -0
- package/lib/module/components/DialogContent.js.map +1 -0
- package/lib/module/components/GlassButton.js +93 -0
- package/lib/module/components/GlassButton.js.map +1 -0
- package/lib/module/components/GlassFab.js +37 -0
- package/lib/module/components/GlassFab.js.map +1 -0
- package/lib/module/components/GlassMagnifier.js +99 -0
- package/lib/module/components/GlassMagnifier.js.map +1 -0
- package/lib/module/components/GlassPlayground.js +122 -0
- package/lib/module/components/GlassPlayground.js.map +1 -0
- package/lib/module/components/GlassSlider.js +328 -0
- package/lib/module/components/GlassSlider.js.map +1 -0
- package/lib/module/components/GlassSwitch.js +298 -0
- package/lib/module/components/GlassSwitch.js.map +1 -0
- package/lib/module/components/GlassTabBar.js +351 -0
- package/lib/module/components/GlassTabBar.js.map +1 -0
- package/lib/module/components/Input.js +144 -0
- package/lib/module/components/Input.js.map +1 -0
- package/lib/module/components/ListRow.js +61 -0
- package/lib/module/components/ListRow.js.map +1 -0
- package/lib/module/components/Menu.js +178 -0
- package/lib/module/components/Menu.js.map +1 -0
- package/lib/module/components/NavigationBar.js +14 -0
- package/lib/module/components/NavigationBar.js.map +1 -0
- package/lib/module/components/NumberWheel.js +238 -0
- package/lib/module/components/NumberWheel.js.map +1 -0
- package/lib/module/components/PageFeedList.js +19 -0
- package/lib/module/components/PageFeedList.js.map +1 -0
- package/lib/module/components/PageScaffold.js +114 -0
- package/lib/module/components/PageScaffold.js.map +1 -0
- package/lib/module/components/PreferenceGroup.js +28 -0
- package/lib/module/components/PreferenceGroup.js.map +1 -0
- package/lib/module/components/ProgressIndicator.js +44 -0
- package/lib/module/components/ProgressIndicator.js.map +1 -0
- package/lib/module/components/ProgressiveBlur.js +26 -0
- package/lib/module/components/ProgressiveBlur.js.map +1 -0
- package/lib/module/components/ReferenceSlider.js +268 -0
- package/lib/module/components/ReferenceSlider.js.map +1 -0
- package/lib/module/components/ReferenceTabBar.js +344 -0
- package/lib/module/components/ReferenceTabBar.js.map +1 -0
- package/lib/module/components/SearchBar.js +164 -0
- package/lib/module/components/SearchBar.js.map +1 -0
- package/lib/module/components/SegmentedControl.js +26 -0
- package/lib/module/components/SegmentedControl.js.map +1 -0
- package/lib/module/components/Slider.js +9 -0
- package/lib/module/components/Slider.js.map +1 -0
- package/lib/module/components/Snackbar.js +8 -0
- package/lib/module/components/Snackbar.js.map +1 -0
- package/lib/module/components/SurfaceEnvironmentContext.js +27 -0
- package/lib/module/components/SurfaceEnvironmentContext.js.map +1 -0
- package/lib/module/components/SurfaceGroup.js +33 -0
- package/lib/module/components/SurfaceGroup.js.map +1 -0
- package/lib/module/components/Switch.js +8 -0
- package/lib/module/components/Switch.js.map +1 -0
- package/lib/module/components/Toast.js +74 -0
- package/lib/module/components/Toast.js.map +1 -0
- package/lib/module/components/TopAppBar.js +68 -0
- package/lib/module/components/TopAppBar.js.map +1 -0
- package/lib/module/components/bottomSheetMotion.js +11 -0
- package/lib/module/components/bottomSheetMotion.js.map +1 -0
- package/lib/module/components/glassControlMaterial.js +19 -0
- package/lib/module/components/glassControlMaterial.js.map +1 -0
- package/lib/module/components/menuPosition.js +37 -0
- package/lib/module/components/menuPosition.js.map +1 -0
- package/lib/module/components/pages/FeedPage.js +12 -0
- package/lib/module/components/pages/FeedPage.js.map +1 -0
- package/lib/module/components/pages/PageBenchmarkContext.js +84 -0
- package/lib/module/components/pages/PageBenchmarkContext.js.map +1 -0
- package/lib/module/components/pages/SettingsPage.js +11 -0
- package/lib/module/components/pages/SettingsPage.js.map +1 -0
- package/lib/module/components/pages/SettingsSection.js +8 -0
- package/lib/module/components/pages/SettingsSection.js.map +1 -0
- package/lib/module/components/pages/StaticSettingsPage.js +10 -0
- package/lib/module/components/pages/StaticSettingsPage.js.map +1 -0
- package/lib/module/fallbackKnobGeometry.js +16 -0
- package/lib/module/fallbackKnobGeometry.js.map +1 -0
- package/lib/module/glassController.js +58 -0
- package/lib/module/glassController.js.map +1 -0
- package/lib/module/glassNativeEngine.js +11 -0
- package/lib/module/glassNativeEngine.js.map +1 -0
- package/lib/module/glassRuntime.js +22 -0
- package/lib/module/glassRuntime.js.map +1 -0
- package/lib/module/index.js +80 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/inputPresentation.js +14 -0
- package/lib/module/inputPresentation.js.map +1 -0
- package/lib/module/localGlassTelemetry.js +103 -0
- package/lib/module/localGlassTelemetry.js.map +1 -0
- package/lib/module/motion/MotionProvider.js +11 -0
- package/lib/module/motion/MotionProvider.js.map +1 -0
- package/lib/module/motion/easings.js +64 -0
- package/lib/module/motion/easings.js.map +1 -0
- package/lib/module/motion/folmeSpring.js +21 -0
- package/lib/module/motion/folmeSpring.js.map +1 -0
- package/lib/module/motion/folmeSpringByResponse.js +19 -0
- package/lib/module/motion/folmeSpringByResponse.js.map +1 -0
- package/lib/module/motion/index.js +6 -0
- package/lib/module/motion/index.js.map +1 -0
- package/lib/module/motion/presets.js +98 -0
- package/lib/module/motion/presets.js.map +1 -0
- package/lib/module/nativeGlassViews.js +27 -0
- package/lib/module/nativeGlassViews.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/performanceTelemetry.js +23 -0
- package/lib/module/performanceTelemetry.js.map +1 -0
- package/lib/module/pointerEventBridge.js +14 -0
- package/lib/module/pointerEventBridge.js.map +1 -0
- package/lib/module/pointerGeometry.js +9 -0
- package/lib/module/pointerGeometry.js.map +1 -0
- package/lib/module/pressVelocity.js +31 -0
- package/lib/module/pressVelocity.js.map +1 -0
- package/lib/module/primitives/Divider.js +29 -0
- package/lib/module/primitives/Divider.js.map +1 -0
- package/lib/module/primitives/Icon.js +19 -0
- package/lib/module/primitives/Icon.js.map +1 -0
- package/lib/module/primitives/PressIndication.js +22 -0
- package/lib/module/primitives/PressIndication.js.map +1 -0
- package/lib/module/primitives/Pressable.js +25 -0
- package/lib/module/primitives/Pressable.js.map +1 -0
- package/lib/module/primitives/PressableScale.js +28 -0
- package/lib/module/primitives/PressableScale.js.map +1 -0
- package/lib/module/primitives/Surface.js +83 -0
- package/lib/module/primitives/Surface.js.map +1 -0
- package/lib/module/primitives/Text.js +40 -0
- package/lib/module/primitives/Text.js.map +1 -0
- package/lib/module/primitives/index.js +8 -0
- package/lib/module/primitives/index.js.map +1 -0
- package/lib/module/renderer.js +22 -0
- package/lib/module/renderer.js.map +1 -0
- package/lib/module/sliderValue.js +25 -0
- package/lib/module/sliderValue.js.map +1 -0
- package/lib/module/surfaceRendererPolicy.js +27 -0
- package/lib/module/surfaceRendererPolicy.js.map +1 -0
- package/lib/module/theme/ThemeProvider.js +32 -0
- package/lib/module/theme/ThemeProvider.js.map +1 -0
- package/lib/module/theme/buildTheme.js +153 -0
- package/lib/module/theme/buildTheme.js.map +1 -0
- package/lib/module/theme/glassColors.js +14 -0
- package/lib/module/theme/glassColors.js.map +1 -0
- package/lib/module/theme/index.js +9 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/liquidGlass.js +21 -0
- package/lib/module/theme/liquidGlass.js.map +1 -0
- package/lib/module/theme/presentation.js +11 -0
- package/lib/module/theme/presentation.js.map +1 -0
- package/lib/module/theme/registry.js +13 -0
- package/lib/module/theme/registry.js.map +1 -0
- package/lib/module/theme/selectVariant.js +10 -0
- package/lib/module/theme/selectVariant.js.map +1 -0
- package/lib/module/theme/tokens.js +262 -0
- package/lib/module/theme/tokens.js.map +1 -0
- package/lib/module/theme/types.js +2 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/theme/wallpaper.js +83 -0
- package/lib/module/theme/wallpaper.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/useButtonGesture.js +132 -0
- package/lib/module/useButtonGesture.js.map +1 -0
- package/lib/module/useGlassKnobMotion.js +112 -0
- package/lib/module/useGlassKnobMotion.js.map +1 -0
- package/lib/module/useGlassPressMotion.js +143 -0
- package/lib/module/useGlassPressMotion.js.map +1 -0
- package/lib/types/GlassSurface.d.ts +216 -0
- package/lib/types/GlassTabBar.d.ts +35 -0
- package/lib/types/GlassTabLens.d.ts +11 -0
- package/lib/types/LiquidGlassProvider.d.ts +47 -0
- package/lib/types/LocalGlassMaterial.d.ts +21 -0
- package/lib/types/adaptiveLuminance.d.ts +2 -0
- package/lib/types/badgePalette.d.ts +9 -0
- package/lib/types/buttonGesturePolicy.d.ts +4 -0
- package/lib/types/components/AdaptiveLuminance.d.ts +23 -0
- package/lib/types/components/BottomSheet.d.ts +33 -0
- package/lib/types/components/Button.d.ts +16 -0
- package/lib/types/components/Card.d.ts +25 -0
- package/lib/types/components/Checkbox.d.ts +11 -0
- package/lib/types/components/ControlPressContext.d.ts +9 -0
- package/lib/types/components/Dialog.d.ts +12 -0
- package/lib/types/components/DialogAction.d.ts +4 -0
- package/lib/types/components/DialogContent.d.ts +12 -0
- package/lib/types/components/GlassButton.d.ts +38 -0
- package/lib/types/components/GlassFab.d.ts +15 -0
- package/lib/types/components/GlassMagnifier.d.ts +41 -0
- package/lib/types/components/GlassPlayground.d.ts +12 -0
- package/lib/types/components/GlassSlider.d.ts +48 -0
- package/lib/types/components/GlassSwitch.d.ts +46 -0
- package/lib/types/components/GlassTabBar.d.ts +44 -0
- package/lib/types/components/Input.d.ts +47 -0
- package/lib/types/components/ListRow.d.ts +17 -0
- package/lib/types/components/Menu.d.ts +41 -0
- package/lib/types/components/NavigationBar.d.ts +14 -0
- package/lib/types/components/NumberWheel.d.ts +11 -0
- package/lib/types/components/PageFeedList.d.ts +6 -0
- package/lib/types/components/PageScaffold.d.ts +64 -0
- package/lib/types/components/PreferenceGroup.d.ts +12 -0
- package/lib/types/components/ProgressIndicator.d.ts +9 -0
- package/lib/types/components/ProgressiveBlur.d.ts +12 -0
- package/lib/types/components/ReferenceSlider.d.ts +31 -0
- package/lib/types/components/ReferenceTabBar.d.ts +61 -0
- package/lib/types/components/SearchBar.d.ts +52 -0
- package/lib/types/components/SegmentedControl.d.ts +10 -0
- package/lib/types/components/Slider.d.ts +19 -0
- package/lib/types/components/Snackbar.d.ts +5 -0
- package/lib/types/components/SurfaceEnvironmentContext.d.ts +17 -0
- package/lib/types/components/SurfaceGroup.d.ts +17 -0
- package/lib/types/components/Switch.d.ts +12 -0
- package/lib/types/components/Toast.d.ts +14 -0
- package/lib/types/components/TopAppBar.d.ts +49 -0
- package/lib/types/components/bottomSheetMotion.d.ts +2 -0
- package/lib/types/components/glassControlMaterial.d.ts +3 -0
- package/lib/types/components/menuPosition.d.ts +22 -0
- package/lib/types/components/pages/FeedPage.d.ts +31 -0
- package/lib/types/components/pages/PageBenchmarkContext.d.ts +30 -0
- package/lib/types/components/pages/SettingsPage.d.ts +20 -0
- package/lib/types/components/pages/SettingsSection.d.ts +9 -0
- package/lib/types/components/pages/StaticSettingsPage.d.ts +18 -0
- package/lib/types/fallbackKnobGeometry.d.ts +7 -0
- package/lib/types/glassController.d.ts +20 -0
- package/lib/types/glassNativeEngine.d.ts +5 -0
- package/lib/types/glassRuntime.d.ts +7 -0
- package/lib/types/index.d.ts +124 -0
- package/lib/types/inputPresentation.d.ts +12 -0
- package/lib/types/localGlassTelemetry.d.ts +28 -0
- package/lib/types/motion/MotionProvider.d.ts +7 -0
- package/lib/types/motion/easings.d.ts +33 -0
- package/lib/types/motion/folmeSpring.d.ts +15 -0
- package/lib/types/motion/folmeSpringByResponse.d.ts +14 -0
- package/lib/types/motion/index.d.ts +7 -0
- package/lib/types/motion/presets.d.ts +103 -0
- package/lib/types/nativeGlassViews.d.ts +114 -0
- package/lib/types/performanceTelemetry.d.ts +65 -0
- package/lib/types/pointerEventBridge.d.ts +17 -0
- package/lib/types/pointerGeometry.d.ts +2 -0
- package/lib/types/pressVelocity.d.ts +11 -0
- package/lib/types/primitives/Divider.d.ts +19 -0
- package/lib/types/primitives/Icon.d.ts +29 -0
- package/lib/types/primitives/PressIndication.d.ts +26 -0
- package/lib/types/primitives/Pressable.d.ts +9 -0
- package/lib/types/primitives/PressableScale.d.ts +19 -0
- package/lib/types/primitives/Surface.d.ts +63 -0
- package/lib/types/primitives/Text.d.ts +35 -0
- package/lib/types/primitives/index.d.ts +14 -0
- package/lib/types/renderer.d.ts +32 -0
- package/lib/types/sliderValue.d.ts +2 -0
- package/lib/types/surfaceRendererPolicy.d.ts +14 -0
- package/lib/types/theme/ThemeProvider.d.ts +26 -0
- package/lib/types/theme/buildTheme.d.ts +6 -0
- package/lib/types/theme/glassColors.d.ts +13 -0
- package/lib/types/theme/index.d.ts +11 -0
- package/lib/types/theme/liquidGlass.d.ts +5 -0
- package/lib/types/theme/presentation.d.ts +3 -0
- package/lib/types/theme/registry.d.ts +7 -0
- package/lib/types/theme/selectVariant.d.ts +10 -0
- package/lib/types/theme/tokens.d.ts +18 -0
- package/lib/types/theme/types.d.ts +305 -0
- package/lib/types/theme/wallpaper.d.ts +32 -0
- package/lib/types/types.d.ts +127 -0
- package/lib/types/useButtonGesture.d.ts +30 -0
- package/lib/types/useGlassKnobMotion.d.ts +40 -0
- package/lib/types/useGlassPressMotion.d.ts +61 -0
- package/licenses/Apache-2.0-Kyant0-Shapes.txt +191 -0
- package/package.json +139 -4
- package/patches/liquid-glass-kit+1.0.0.patch +2015 -0
- package/patches/liquid-glass-kit-invalidation-coalescing.diff +249 -0
- package/patches/liquid-glass-kit-native-infra.diff +624 -0
- package/scripts/apply-legacy-patches.mjs +116 -0
- package/src/GlassSurface.tsx +1786 -0
- package/src/GlassTabBar.tsx +1304 -0
- package/src/GlassTabLens.tsx +92 -0
- package/src/LiquidGlassProvider.tsx +135 -0
- package/src/LocalGlassMaterial.tsx +262 -0
- package/src/adaptiveLuminance.ts +15 -0
- package/src/badgePalette.ts +54 -0
- package/src/buttonGesturePolicy.ts +15 -0
- package/src/components/AdaptiveLuminance.tsx +40 -0
- package/src/components/BottomSheet.tsx +291 -0
- package/src/components/Button.tsx +30 -0
- package/src/components/Card.tsx +343 -0
- package/src/components/Checkbox.tsx +141 -0
- package/src/components/ControlPressContext.ts +11 -0
- package/src/components/Dialog.tsx +129 -0
- package/src/components/DialogAction.tsx +109 -0
- package/src/components/DialogContent.tsx +52 -0
- package/src/components/GlassButton.tsx +225 -0
- package/src/components/GlassFab.tsx +98 -0
- package/src/components/GlassMagnifier.tsx +178 -0
- package/src/components/GlassPlayground.tsx +190 -0
- package/src/components/GlassSlider.tsx +448 -0
- package/src/components/GlassSwitch.tsx +391 -0
- package/src/components/GlassTabBar.tsx +522 -0
- package/src/components/Input.tsx +277 -0
- package/src/components/ListRow.tsx +124 -0
- package/src/components/Menu.tsx +322 -0
- package/src/components/NavigationBar.tsx +27 -0
- package/src/components/NumberWheel.tsx +344 -0
- package/src/components/PageFeedList.tsx +37 -0
- package/src/components/PageScaffold.tsx +266 -0
- package/src/components/PreferenceGroup.tsx +65 -0
- package/src/components/ProgressIndicator.tsx +63 -0
- package/src/components/ProgressiveBlur.tsx +56 -0
- package/src/components/ReferenceSlider.tsx +364 -0
- package/src/components/ReferenceTabBar.tsx +564 -0
- package/src/components/SearchBar.tsx +340 -0
- package/src/components/SegmentedControl.tsx +45 -0
- package/src/components/Slider.tsx +25 -0
- package/src/components/Snackbar.tsx +10 -0
- package/src/components/SurfaceEnvironmentContext.tsx +46 -0
- package/src/components/SurfaceGroup.tsx +60 -0
- package/src/components/Switch.tsx +18 -0
- package/src/components/Toast.tsx +110 -0
- package/src/components/TopAppBar.tsx +272 -0
- package/src/components/bottomSheetMotion.ts +10 -0
- package/src/components/glassControlMaterial.ts +20 -0
- package/src/components/menuPosition.ts +58 -0
- package/src/components/pages/FeedPage.tsx +96 -0
- package/src/components/pages/PageBenchmarkContext.tsx +105 -0
- package/src/components/pages/SettingsPage.tsx +55 -0
- package/src/components/pages/SettingsSection.tsx +20 -0
- package/src/components/pages/StaticSettingsPage.tsx +50 -0
- package/src/fallbackKnobGeometry.ts +15 -0
- package/src/glassController.ts +74 -0
- package/src/glassNativeEngine.ts +16 -0
- package/src/glassRuntime.ts +28 -0
- package/src/index.ts +199 -0
- package/src/inputPresentation.ts +32 -0
- package/src/localGlassTelemetry.ts +138 -0
- package/src/motion/MotionProvider.tsx +12 -0
- package/src/motion/easings.ts +71 -0
- package/src/motion/folmeSpring.ts +22 -0
- package/src/motion/folmeSpringByResponse.ts +19 -0
- package/src/motion/index.ts +47 -0
- package/src/motion/presets.ts +128 -0
- package/src/nativeGlassViews.ts +147 -0
- package/src/performanceTelemetry.ts +95 -0
- package/src/pointerEventBridge.ts +27 -0
- package/src/pointerGeometry.ts +8 -0
- package/src/pressVelocity.ts +36 -0
- package/src/primitives/Divider.tsx +42 -0
- package/src/primitives/Icon.tsx +44 -0
- package/src/primitives/PressIndication.tsx +43 -0
- package/src/primitives/Pressable.tsx +75 -0
- package/src/primitives/PressableScale.tsx +50 -0
- package/src/primitives/Surface.tsx +171 -0
- package/src/primitives/Text.tsx +80 -0
- package/src/primitives/index.ts +14 -0
- package/src/renderer.ts +70 -0
- package/src/sliderValue.ts +19 -0
- package/src/surfaceRendererPolicy.ts +32 -0
- package/src/theme/ThemeProvider.tsx +52 -0
- package/src/theme/buildTheme.ts +160 -0
- package/src/theme/glassColors.ts +13 -0
- package/src/theme/index.ts +34 -0
- package/src/theme/liquidGlass.ts +25 -0
- package/src/theme/presentation.ts +12 -0
- package/src/theme/registry.ts +16 -0
- package/src/theme/selectVariant.ts +12 -0
- package/src/theme/tokens.ts +309 -0
- package/src/theme/types.ts +345 -0
- package/src/theme/wallpaper.ts +94 -0
- package/src/types.ts +95 -0
- package/src/useButtonGesture.ts +134 -0
- package/src/useGlassKnobMotion.ts +155 -0
- package/src/useGlassPressMotion.ts +209 -0
|
@@ -0,0 +1,832 @@
|
|
|
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.GlassSurface = void 0;
|
|
37
|
+
exports.GlassPortalScrollScope = GlassPortalScrollScope;
|
|
38
|
+
exports.GlassRouteTransitionScope = GlassRouteTransitionScope;
|
|
39
|
+
exports.useGlassReducedMotion = useGlassReducedMotion;
|
|
40
|
+
exports.useGlassInsideScroll = useGlassInsideScroll;
|
|
41
|
+
exports.useGlassInsideCaptureScope = useGlassInsideCaptureScope;
|
|
42
|
+
exports.useGlassAppearance = useGlassAppearance;
|
|
43
|
+
exports.useGlassSamplingProviderId = useGlassSamplingProviderId;
|
|
44
|
+
exports.RouteGlassCaptureScope = RouteGlassCaptureScope;
|
|
45
|
+
exports.RouteGlassCaptureSource = RouteGlassCaptureSource;
|
|
46
|
+
exports.GlassAppearanceProvider = GlassAppearanceProvider;
|
|
47
|
+
exports.GlassMaterialProvider = GlassMaterialProvider;
|
|
48
|
+
exports.useGlassProviderId = useGlassProviderId;
|
|
49
|
+
exports.useGlassOverlayHostRef = useGlassOverlayHostRef;
|
|
50
|
+
exports.GlassOverlay = GlassOverlay;
|
|
51
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
52
|
+
const react_1 = __importStar(require("react"));
|
|
53
|
+
const react_native_1 = require("react-native");
|
|
54
|
+
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
55
|
+
const LocalGlassMaterial_1 = require("./LocalGlassMaterial");
|
|
56
|
+
const glassNativeEngine_1 = require("./glassNativeEngine");
|
|
57
|
+
const glassController_1 = require("./glassController");
|
|
58
|
+
const nativeGlassViews_1 = require("./nativeGlassViews");
|
|
59
|
+
const AnimatedLegacyGlassSurfaceView = react_native_reanimated_1.default.createAnimatedComponent(nativeGlassViews_1.LegacyGlassSurfaceView);
|
|
60
|
+
const AnimatedCoreGlassSurfaceView = nativeGlassViews_1.CoreGlassSurfaceView
|
|
61
|
+
? react_native_reanimated_1.default.createAnimatedComponent(nativeGlassViews_1.CoreGlassSurfaceView)
|
|
62
|
+
: null;
|
|
63
|
+
const GlassRuntimeContext = (0, react_1.createContext)(null);
|
|
64
|
+
const GlassCaptureSourceContext = (0, react_1.createContext)(null);
|
|
65
|
+
const GlassNativeEngineContext = (0, react_1.createContext)('legacy');
|
|
66
|
+
const GlassRouteTransitionContext = (0, react_1.createContext)(null);
|
|
67
|
+
const GlassPortalScrollContext = (0, react_1.createContext)({ offsets: [], layoutRevision: 0, groupKey: '' });
|
|
68
|
+
const GlassMeasureOnlyContext = (0, react_1.createContext)(false);
|
|
69
|
+
/** Keeps backdrop surfaces aligned with content inside a scroll container. */
|
|
70
|
+
function GlassPortalScrollScope({ scrollOffset, layoutRevision = 0, children, }) {
|
|
71
|
+
const scopeId = (0, react_1.useId)();
|
|
72
|
+
const parent = (0, react_1.useContext)(GlassPortalScrollContext);
|
|
73
|
+
const value = (0, react_1.useMemo)(() => ({
|
|
74
|
+
offsets: [...parent.offsets, scrollOffset],
|
|
75
|
+
layoutRevision: parent.layoutRevision + layoutRevision,
|
|
76
|
+
groupKey: parent.groupKey ? `${parent.groupKey}|${scopeId}` : scopeId,
|
|
77
|
+
}), [layoutRevision, parent, scopeId, scrollOffset]);
|
|
78
|
+
return (0, jsx_runtime_1.jsx)(GlassPortalScrollContext.Provider, { value: value, children: children });
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Shares a route's horizontal transition with portaled glass surfaces.
|
|
82
|
+
* Backdrop surfaces live in a host-level overlay, so an ancestor transform is
|
|
83
|
+
* not inherited automatically. This scope keeps their window frames and the
|
|
84
|
+
* visible React Native content on the same animation value.
|
|
85
|
+
*/
|
|
86
|
+
function GlassRouteTransitionScope({ translateX, children, }) {
|
|
87
|
+
return (0, jsx_runtime_1.jsx)(GlassRouteTransitionContext.Provider, { value: translateX, children: children });
|
|
88
|
+
}
|
|
89
|
+
function useGlassReducedMotion() {
|
|
90
|
+
return (0, react_1.useContext)(GlassRuntimeContext)?.reducedMotion ?? false;
|
|
91
|
+
}
|
|
92
|
+
function useGlassInsideScroll() {
|
|
93
|
+
return (0, react_1.useContext)(GlassPortalScrollContext).offsets.length > 0;
|
|
94
|
+
}
|
|
95
|
+
function useGlassInsideCaptureScope() {
|
|
96
|
+
return (0, react_1.useContext)(GlassCaptureSourceContext) !== null;
|
|
97
|
+
}
|
|
98
|
+
function useGlassAppearance() {
|
|
99
|
+
return (0, react_1.useContext)(GlassRuntimeContext);
|
|
100
|
+
}
|
|
101
|
+
/** Resolve the provider that represents the visible scene for a glass consumer. */
|
|
102
|
+
function useGlassSamplingProviderId(source = 'routeScene') {
|
|
103
|
+
const host = (0, react_1.useContext)(GlassHostContext);
|
|
104
|
+
const captureSourceProviderId = (0, react_1.useContext)(GlassCaptureSourceContext);
|
|
105
|
+
if (!host)
|
|
106
|
+
return null;
|
|
107
|
+
return source === 'themeBackdrop'
|
|
108
|
+
? host.themeBackdropProviderId
|
|
109
|
+
: captureSourceProviderId ?? host.routeSceneProviderId ?? host.themeBackdropProviderId;
|
|
110
|
+
}
|
|
111
|
+
function createEntryRegistry() {
|
|
112
|
+
const entries = new Map();
|
|
113
|
+
const listeners = new Set();
|
|
114
|
+
let snapshot = [];
|
|
115
|
+
const publish = () => {
|
|
116
|
+
snapshot = Array.from(entries.entries());
|
|
117
|
+
for (const listener of listeners)
|
|
118
|
+
listener();
|
|
119
|
+
};
|
|
120
|
+
return {
|
|
121
|
+
getSnapshot: () => snapshot,
|
|
122
|
+
subscribe: (listener) => {
|
|
123
|
+
listeners.add(listener);
|
|
124
|
+
return () => listeners.delete(listener);
|
|
125
|
+
},
|
|
126
|
+
update: (id, entry, equals) => {
|
|
127
|
+
const previous = entries.get(id);
|
|
128
|
+
if (previous !== undefined && equals(previous, entry))
|
|
129
|
+
return;
|
|
130
|
+
entries.set(id, entry);
|
|
131
|
+
publish();
|
|
132
|
+
},
|
|
133
|
+
remove: (id) => {
|
|
134
|
+
if (!entries.delete(id))
|
|
135
|
+
return;
|
|
136
|
+
publish();
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function useRegistrySnapshot(registry) {
|
|
141
|
+
return react_1.default.useSyncExternalStore(registry.subscribe, registry.getSnapshot, registry.getSnapshot);
|
|
142
|
+
}
|
|
143
|
+
function sameSurface(previous, next) {
|
|
144
|
+
return previous.frame.x === next.frame.x && previous.frame.y === next.frame.y &&
|
|
145
|
+
previous.frame.width === next.frame.width && previous.frame.height === next.frame.height &&
|
|
146
|
+
previous.positioning === next.positioning && previous.samplingSource === next.samplingSource &&
|
|
147
|
+
previous.samplingProviderId === next.samplingProviderId &&
|
|
148
|
+
previous.tintColor === next.tintColor && previous.portalContent === next.portalContent &&
|
|
149
|
+
previous.contentAboveGlass === next.contentAboveGlass && previous.content === next.content && previous.contentStyle === next.contentStyle &&
|
|
150
|
+
previous.variant === next.variant && previous.interactive === next.interactive && previous.continuous === next.continuous &&
|
|
151
|
+
previous.sharedSource === next.sharedSource && previous.captureProbe === next.captureProbe &&
|
|
152
|
+
previous.opticalProgress === next.opticalProgress && previous.scrollGroupKey === next.scrollGroupKey && previous.scrollOffsets === next.scrollOffsets && previous.routeTransitionX === next.routeTransitionX && previous.portalOffsetStyle === next.portalOffsetStyle && previous.portalTranslateX === next.portalTranslateX && previous.portalTranslateY === next.portalTranslateY && previous.portalScaleX === next.portalScaleX && previous.portalScaleY === next.portalScaleY && previous.pointerEvent === next.pointerEvent && previous.pointerEventValue === next.pointerEventValue && previous.pointerEventSink === next.pointerEventSink && previous.valueEvent === next.valueEvent && previous.valueEventSink === next.valueEventSink && previous.opticalToggleFraction === next.opticalToggleFraction && previous.opticalProgressValue === next.opticalProgressValue && previous.opticalPointX === next.opticalPointX && previous.opticalPointY === next.opticalPointY && previous.opticalMotionX === next.opticalMotionX && previous.opticalMotionY === next.opticalMotionY &&
|
|
153
|
+
previous.opticalVelocityX === next.opticalVelocityX && previous.opticalVelocityY === next.opticalVelocityY &&
|
|
154
|
+
previous.materialOverrides === next.materialOverrides && previous.displacementOnlyDebug === next.displacementOnlyDebug &&
|
|
155
|
+
previous.syncContentTransform === next.syncContentTransform &&
|
|
156
|
+
previous.shapeMaskText === next.shapeMaskText && previous.shapeMaskFontSize === next.shapeMaskFontSize && previous.shapeMaskFontWeight === next.shapeMaskFontWeight &&
|
|
157
|
+
previous.progressiveBlurIntensity === next.progressiveBlurIntensity &&
|
|
158
|
+
previous.animatedStyle === next.animatedStyle && previous.placement === next.placement &&
|
|
159
|
+
previous.bottomInset === next.bottomInset && previous.zIndex === next.zIndex;
|
|
160
|
+
}
|
|
161
|
+
function sameOverlay(previous, next) {
|
|
162
|
+
return previous.children === next.children && previous.style === next.style &&
|
|
163
|
+
previous.frame?.x === next.frame?.x && previous.frame?.y === next.frame?.y &&
|
|
164
|
+
previous.frame?.width === next.frame?.width && previous.frame?.height === next.frame?.height &&
|
|
165
|
+
previous.scrollOffsets === next.scrollOffsets && previous.routeTransitionX === next.routeTransitionX &&
|
|
166
|
+
previous.portalOffsetStyle === next.portalOffsetStyle && previous.zIndex === next.zIndex;
|
|
167
|
+
}
|
|
168
|
+
function selectBalancedShaderSurfaces(entries) {
|
|
169
|
+
// Every mounted backdrop surface keeps the same renderer regardless of
|
|
170
|
+
// quality preset; display cadence is selected by the native provider.
|
|
171
|
+
return new Set(entries.map(([id]) => id));
|
|
172
|
+
}
|
|
173
|
+
const GlassHostContext = (0, react_1.createContext)(null);
|
|
174
|
+
function RouteGlassCaptureScope({ children, active = true, scopeId = 'page-content' }) {
|
|
175
|
+
const host = (0, react_1.useContext)(GlassHostContext);
|
|
176
|
+
const parentActive = (0, react_1.useContext)(GlassScopeActiveContext);
|
|
177
|
+
const parentProviderId = (0, react_1.useContext)(GlassCaptureSourceContext);
|
|
178
|
+
const baseId = parentProviderId ?? host?.providerId ?? null;
|
|
179
|
+
const providerId = baseId ? `${baseId}:${scopeId}` : null;
|
|
180
|
+
return ((0, jsx_runtime_1.jsx)(GlassScopeActiveContext.Provider, { value: active && parentActive, children: (0, jsx_runtime_1.jsx)(GlassCaptureSourceContext.Provider, { value: providerId, children: children }) }));
|
|
181
|
+
}
|
|
182
|
+
function RouteGlassCaptureSource({ children, captureMode, captureOnly = false, sourceRevision, underlayProviderId, style, }) {
|
|
183
|
+
const host = (0, react_1.useContext)(GlassHostContext);
|
|
184
|
+
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
185
|
+
const scopedProviderId = (0, react_1.useContext)(GlassCaptureSourceContext);
|
|
186
|
+
const scopeActive = (0, react_1.useContext)(GlassScopeActiveContext);
|
|
187
|
+
const inactiveId = (0, react_1.useId)();
|
|
188
|
+
// Pager siblings share a route-scene alias. A hidden page must retain its
|
|
189
|
+
// native tree without replacing the visible page in the provider registry.
|
|
190
|
+
const providerId = !scopeActive && scopedProviderId
|
|
191
|
+
? `${scopedProviderId}:inactive:${inactiveId}`
|
|
192
|
+
: scopedProviderId;
|
|
193
|
+
if (!host || !providerId || !runtime?.tokens.enabled)
|
|
194
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
195
|
+
const resolvedCaptureMode = !scopeActive ? 'frozen'
|
|
196
|
+
: captureMode ?? (react_native_1.Platform.OS === 'android' && (0, glassNativeEngine_1.getGlassNativeEngine)() === 'core' ? 'oneShotPassThrough' : 'live');
|
|
197
|
+
const resolvedUnderlay = underlayProviderId === null
|
|
198
|
+
? undefined
|
|
199
|
+
: underlayProviderId ?? host.routeSceneProviderId ?? host.themeBackdropProviderId;
|
|
200
|
+
return ((0, jsx_runtime_1.jsx)(GlassCaptureSourceView, { providerId: providerId, underlayProviderId: resolvedUnderlay, captureMode: resolvedCaptureMode, captureOnly: (0, glassNativeEngine_1.getGlassNativeEngine)() === 'core' ? captureOnly : undefined, sourceRevision: sourceRevision, pointerEvents: "box-none", style: [styles.captureSource, style], children: children }));
|
|
201
|
+
}
|
|
202
|
+
function NativeBackdropSurface({ opticsModel, sdfDisplacementMapDebug, sdfContrast, sdfBrightness, sdfSaturation, sdfOuterShadowAlpha, sdfOuterShadowBlurRadius, sdfOuterShadowOffsetY, sdfInnerShadowAlpha, sdfInnerShadowExtent, shapeMaskText, shapeMaskFontSize, shapeMaskFontWeight, sharedPassOrder, sharedPassZIndex, pointerEventSink, valueEventSink, syncContentTransform, renderingEnabled = true, ...props }) {
|
|
203
|
+
const nativeEngine = (0, react_1.useContext)(GlassNativeEngineContext);
|
|
204
|
+
const nativeViewRef = (0, react_1.useRef)(null);
|
|
205
|
+
(0, react_1.useEffect)(() => {
|
|
206
|
+
const viewTag = nativeEngine === 'core' && nativeViewRef.current
|
|
207
|
+
? (0, react_native_1.findNodeHandle)(nativeViewRef.current)
|
|
208
|
+
: null;
|
|
209
|
+
if (pointerEventSink) {
|
|
210
|
+
pointerEventSink.current = viewTag == null
|
|
211
|
+
? null
|
|
212
|
+
: (payload) => (0, glassController_1.forwardPointerToSurface)(viewTag, payload);
|
|
213
|
+
}
|
|
214
|
+
if (valueEventSink) {
|
|
215
|
+
valueEventSink.current = viewTag == null
|
|
216
|
+
? null
|
|
217
|
+
: (payload) => (0, glassController_1.forwardValueToSurface)(viewTag, payload);
|
|
218
|
+
}
|
|
219
|
+
return () => {
|
|
220
|
+
if (pointerEventSink)
|
|
221
|
+
pointerEventSink.current = null;
|
|
222
|
+
if (valueEventSink)
|
|
223
|
+
valueEventSink.current = null;
|
|
224
|
+
};
|
|
225
|
+
}, [nativeEngine, pointerEventSink, valueEventSink]);
|
|
226
|
+
// 'core' is the default, but the core view only exists on Android. Falling back
|
|
227
|
+
// to the legacy view there keeps iOS and any missing registration drawing
|
|
228
|
+
// something instead of nothing.
|
|
229
|
+
if (nativeEngine === 'core') {
|
|
230
|
+
if (props.animatedProps == null && nativeGlassViews_1.CoreGlassSurfaceView) {
|
|
231
|
+
const { animatedProps: _unused, ...staticProps } = props;
|
|
232
|
+
return ((0, jsx_runtime_1.jsx)(nativeGlassViews_1.CoreGlassSurfaceView, { ref: nativeViewRef, renderingEnabled: renderingEnabled, ...staticProps, sharedPassOrder: sharedPassOrder, sharedPassZIndex: sharedPassZIndex, opticsModel: opticsModel, sdfDisplacementMapDebug: sdfDisplacementMapDebug, sdfContrast: sdfContrast, sdfBrightness: sdfBrightness, sdfSaturation: sdfSaturation, sdfOuterShadowAlpha: sdfOuterShadowAlpha, sdfOuterShadowBlurRadius: sdfOuterShadowBlurRadius, sdfOuterShadowOffsetY: sdfOuterShadowOffsetY, sdfInnerShadowAlpha: sdfInnerShadowAlpha, sdfInnerShadowExtent: sdfInnerShadowExtent, shapeMaskText: shapeMaskText, shapeMaskFontSize: shapeMaskFontSize, shapeMaskFontWeight: shapeMaskFontWeight, syncContentTransform: syncContentTransform }));
|
|
233
|
+
}
|
|
234
|
+
if (AnimatedCoreGlassSurfaceView) {
|
|
235
|
+
return ((0, jsx_runtime_1.jsx)(AnimatedCoreGlassSurfaceView, { ref: nativeViewRef, renderingEnabled: renderingEnabled, ...props, sharedPassOrder: sharedPassOrder, sharedPassZIndex: sharedPassZIndex, opticsModel: opticsModel, sdfDisplacementMapDebug: sdfDisplacementMapDebug, sdfContrast: sdfContrast, sdfBrightness: sdfBrightness, sdfSaturation: sdfSaturation, sdfOuterShadowAlpha: sdfOuterShadowAlpha, sdfOuterShadowBlurRadius: sdfOuterShadowBlurRadius, sdfOuterShadowOffsetY: sdfOuterShadowOffsetY, sdfInnerShadowAlpha: sdfInnerShadowAlpha, sdfInnerShadowExtent: sdfInnerShadowExtent, shapeMaskText: shapeMaskText, shapeMaskFontSize: shapeMaskFontSize, shapeMaskFontWeight: shapeMaskFontWeight, syncContentTransform: syncContentTransform }));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return (0, jsx_runtime_1.jsx)(AnimatedLegacyGlassSurfaceView, { ...props, style: [props.style, !renderingEnabled ? { opacity: 0 } : undefined] });
|
|
239
|
+
}
|
|
240
|
+
function GlassCaptureSourceView({ children, ...props }) {
|
|
241
|
+
const nativeEngine = (0, react_1.useContext)(GlassNativeEngineContext);
|
|
242
|
+
if (nativeEngine === 'core' && nativeGlassViews_1.CoreGlassCaptureSource) {
|
|
243
|
+
return (0, jsx_runtime_1.jsx)(nativeGlassViews_1.CoreGlassCaptureSource, { ...props, children: children });
|
|
244
|
+
}
|
|
245
|
+
return (0, jsx_runtime_1.jsx)(nativeGlassViews_1.LegacyGlassCaptureSource, { ...props, children: children });
|
|
246
|
+
}
|
|
247
|
+
const GlassOverlayHostContext = (0, react_1.createContext)(null);
|
|
248
|
+
/**
|
|
249
|
+
* Page-level scope for glass surfaces.
|
|
250
|
+
*
|
|
251
|
+
* Every page under a PagerView shares one provider id (`host.providerId +
|
|
252
|
+
* ':page-content'`) and one registry, and GlassSurfacePortalLayer draws every
|
|
253
|
+
* registered entry in a provider-level layer above page content. So a kept-alive
|
|
254
|
+
* page's surfaces paint on top of whichever page is actually visible: on Home
|
|
255
|
+
* that showed up as an empty 344x55dp panel under the search bar, which turned
|
|
256
|
+
* out to be the User page's segmented control.
|
|
257
|
+
*
|
|
258
|
+
* A surface whose scope is inactive stops publishing. Layout is untouched; only
|
|
259
|
+
* the registry entry goes away, so nothing is drawn for it.
|
|
260
|
+
*/
|
|
261
|
+
const GlassScopeActiveContext = (0, react_1.createContext)(true);
|
|
262
|
+
function GlassAppearanceProvider({ children, tokens, dark, reducedMotion = false }) {
|
|
263
|
+
const runtime = (0, react_1.useMemo)(() => ({ tokens, dark, reducedMotion }), [tokens, dark, reducedMotion]);
|
|
264
|
+
return (0, jsx_runtime_1.jsx)(GlassRuntimeContext.Provider, { value: runtime, children: children });
|
|
265
|
+
}
|
|
266
|
+
function GlassMaterialProvider({ children, backdrop, themeBackdrop, themeBackdropRevision, inlineBackdropByDefault = false, defaultSamplingSource = 'routeScene', providerId: providerIdProp, style, tokens, dark, reducedMotion = false, active = true }) {
|
|
267
|
+
const hostRef = (0, react_1.useRef)(null);
|
|
268
|
+
const generatedProviderId = (0, react_1.useId)();
|
|
269
|
+
const providerId = providerIdProp ?? generatedProviderId;
|
|
270
|
+
const routeSceneProviderId = backdrop !== undefined ? providerId : null;
|
|
271
|
+
const generatedThemeBackdropProviderId = (0, react_1.useId)();
|
|
272
|
+
// When a separate stable theme backdrop was not supplied, the provider's
|
|
273
|
+
// base backdrop is the stable scene. Aliasing its id avoids recording that
|
|
274
|
+
// exact scene into a second native source just to support inline lenses.
|
|
275
|
+
const themeBackdropProviderId = themeBackdrop !== undefined ? generatedThemeBackdropProviderId : providerId;
|
|
276
|
+
const surfaceRegistryRef = (0, react_1.useRef)(null);
|
|
277
|
+
const overlayRegistryRef = (0, react_1.useRef)(null);
|
|
278
|
+
if (!surfaceRegistryRef.current)
|
|
279
|
+
surfaceRegistryRef.current = createEntryRegistry();
|
|
280
|
+
if (!overlayRegistryRef.current)
|
|
281
|
+
overlayRegistryRef.current = createEntryRegistry();
|
|
282
|
+
const surfaceRegistry = surfaceRegistryRef.current;
|
|
283
|
+
const overlayRegistry = overlayRegistryRef.current;
|
|
284
|
+
const runtime = (0, react_1.useMemo)(() => ({ tokens, dark, reducedMotion }), [tokens, dark, reducedMotion]);
|
|
285
|
+
const nativeEngine = (0, react_1.useSyncExternalStore)(glassNativeEngine_1.subscribeGlassNativeEngine, glassNativeEngine_1.getGlassNativeEngine, glassNativeEngine_1.getGlassNativeEngine);
|
|
286
|
+
const updateSurface = (0, react_1.useCallback)((id, entry) => {
|
|
287
|
+
surfaceRegistry.update(id, entry, sameSurface);
|
|
288
|
+
}, [surfaceRegistry]);
|
|
289
|
+
const updateOverlay = (0, react_1.useCallback)((id, entry) => {
|
|
290
|
+
overlayRegistry.update(id, entry, sameOverlay);
|
|
291
|
+
}, [overlayRegistry]);
|
|
292
|
+
const removeOverlay = (0, react_1.useCallback)((id) => {
|
|
293
|
+
overlayRegistry.remove(id);
|
|
294
|
+
}, [overlayRegistry]);
|
|
295
|
+
const remove = (0, react_1.useCallback)((id) => {
|
|
296
|
+
surfaceRegistry.remove(id);
|
|
297
|
+
overlayRegistry.remove(id);
|
|
298
|
+
}, [surfaceRegistry, overlayRegistry]);
|
|
299
|
+
const hasSeparateBackdrop = backdrop !== undefined;
|
|
300
|
+
const context = (0, react_1.useMemo)(() => ({ providerId, routeSceneProviderId, themeBackdropProviderId, inlineBackdropByDefault, hasSeparateBackdrop, defaultSamplingSource, hostRef, updateSurface, updateOverlay, removeOverlay, remove }), [providerId, routeSceneProviderId, themeBackdropProviderId, inlineBackdropByDefault, hasSeparateBackdrop, defaultSamplingSource, updateSurface, updateOverlay, removeOverlay, remove]);
|
|
301
|
+
const overlayContext = (0, react_1.useMemo)(() => ({ providerId, updateOverlay, remove }), [providerId, updateOverlay, remove]);
|
|
302
|
+
const recording = active && tokens.enabled;
|
|
303
|
+
return ((0, jsx_runtime_1.jsx)(GlassNativeEngineContext.Provider, { value: nativeEngine, children: (0, jsx_runtime_1.jsx)(GlassRuntimeContext.Provider, { value: runtime, children: (0, jsx_runtime_1.jsx)(GlassHostContext.Provider, { value: context, children: (0, jsx_runtime_1.jsx)(GlassOverlayHostContext.Provider, { value: overlayContext, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: hostRef, collapsable: false, style: [styles.root, style], children: (0, jsx_runtime_1.jsxs)(GlassScopeActiveContext.Provider, { value: recording, children: [recording && themeBackdrop !== undefined ? ((0, jsx_runtime_1.jsx)(GlassCaptureSourceView, { providerId: themeBackdropProviderId, captureMode: "static", sourceRevision: themeBackdropRevision, pointerEvents: "none", style: react_native_1.StyleSheet.absoluteFill, children: themeBackdrop })) : null, hasSeparateBackdrop ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GlassCaptureSourceView, { providerId: providerId, underlayProviderId: themeBackdrop !== undefined ? themeBackdropProviderId : undefined, captureMode: recording ? 'live' : 'frozen', style: react_native_1.StyleSheet.absoluteFill, children: backdrop }), (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: react_native_1.StyleSheet.absoluteFill, children: children })] })) : ((0, jsx_runtime_1.jsx)(GlassCaptureSourceView, { providerId: providerId, underlayProviderId: themeBackdrop !== undefined ? themeBackdropProviderId : undefined, captureMode: recording ? 'live' : 'frozen', style: react_native_1.StyleSheet.absoluteFill, children: children })), (0, jsx_runtime_1.jsx)(GlassSurfacePortalLayer, { registry: surfaceRegistry, tokens: tokens }), (0, jsx_runtime_1.jsx)(GlassRouteOverlayLayer, { registry: overlayRegistry, enabled: recording })] }) }) }) }) }) }));
|
|
304
|
+
}
|
|
305
|
+
function GlassSurfacePortalLayer({ registry, tokens }) {
|
|
306
|
+
const entries = useRegistrySnapshot(registry);
|
|
307
|
+
const balancedShaderSurfaces = (0, react_1.useMemo)(() => selectBalancedShaderSurfaces(entries), [entries]);
|
|
308
|
+
const groups = (0, react_1.useMemo)(() => {
|
|
309
|
+
const list = [];
|
|
310
|
+
const byKey = new Map();
|
|
311
|
+
for (let i = 0; i < entries.length; i += 1) {
|
|
312
|
+
const pair = entries[i];
|
|
313
|
+
const entry = pair[1];
|
|
314
|
+
const routeId = getSharedValueId(entry.routeTransitionX);
|
|
315
|
+
const key = `${entry.zIndex}::${entry.scrollGroupKey}::${routeId}`;
|
|
316
|
+
let group = byKey.get(key);
|
|
317
|
+
if (!group) {
|
|
318
|
+
group = {
|
|
319
|
+
key,
|
|
320
|
+
zIndex: entry.zIndex,
|
|
321
|
+
offsets: entry.scrollOffsets,
|
|
322
|
+
routeTransitionX: entry.routeTransitionX,
|
|
323
|
+
items: [],
|
|
324
|
+
};
|
|
325
|
+
byKey.set(key, group);
|
|
326
|
+
list.push(group);
|
|
327
|
+
}
|
|
328
|
+
group.items.push(pair);
|
|
329
|
+
}
|
|
330
|
+
return list;
|
|
331
|
+
}, [entries]);
|
|
332
|
+
if (!tokens.enabled)
|
|
333
|
+
return null;
|
|
334
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: react_native_1.StyleSheet.absoluteFill, children: groups.map((group) => {
|
|
335
|
+
const content = group.items.map(([id, entry]) => ((0, jsx_runtime_1.jsx)(PortalGlassSurface, { providerId: entry.samplingProviderId, entry: entry, drawOrder: 0, shaderEnabled: tokens.quality === 'high' || (tokens.quality === 'balanced' && balancedShaderSurfaces.has(id)) }, id)));
|
|
336
|
+
if (group.offsets.length === 0 && !group.routeTransitionX) {
|
|
337
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: [react_native_1.StyleSheet.absoluteFill, { zIndex: group.zIndex }], children: content }, group.key));
|
|
338
|
+
}
|
|
339
|
+
return ((0, jsx_runtime_1.jsx)(PortalScrollGroupContainer, { offsets: group.offsets, routeTransitionX: group.routeTransitionX, zIndex: group.zIndex, children: content }, group.key));
|
|
340
|
+
}) }));
|
|
341
|
+
}
|
|
342
|
+
const sharedValueGroupIds = new WeakMap();
|
|
343
|
+
let nextSharedValueGroupId = 1;
|
|
344
|
+
function getSharedValueId(value) {
|
|
345
|
+
if (!value)
|
|
346
|
+
return 0;
|
|
347
|
+
let id = sharedValueGroupIds.get(value);
|
|
348
|
+
if (id == null) {
|
|
349
|
+
id = nextSharedValueGroupId++;
|
|
350
|
+
sharedValueGroupIds.set(value, id);
|
|
351
|
+
}
|
|
352
|
+
return id;
|
|
353
|
+
}
|
|
354
|
+
const PortalScrollGroupContainer = react_1.default.memo(function PortalScrollGroupContainer({ offsets, routeTransitionX, zIndex, children, }) {
|
|
355
|
+
const groupTransformStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
356
|
+
let scrollY = 0;
|
|
357
|
+
for (let index = 0; index < offsets.length; index += 1) {
|
|
358
|
+
scrollY += offsets[index].value;
|
|
359
|
+
}
|
|
360
|
+
return {
|
|
361
|
+
transform: [
|
|
362
|
+
{ translateX: routeTransitionX?.value ?? 0 },
|
|
363
|
+
{ translateY: -scrollY },
|
|
364
|
+
],
|
|
365
|
+
};
|
|
366
|
+
}, [offsets, routeTransitionX]);
|
|
367
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "box-none", style: [react_native_1.StyleSheet.absoluteFill, groupTransformStyle, { zIndex }], children: children }));
|
|
368
|
+
});
|
|
369
|
+
function GlassRouteOverlayLayer({ registry, enabled }) {
|
|
370
|
+
const entries = useRegistrySnapshot(registry);
|
|
371
|
+
if (!enabled)
|
|
372
|
+
return null;
|
|
373
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: react_native_1.StyleSheet.absoluteFill, children: entries.map(([id, entry]) => (0, jsx_runtime_1.jsx)(RouteOverlayView, { entry: entry }, id)) }));
|
|
374
|
+
}
|
|
375
|
+
const RouteOverlayView = react_1.default.memo(function RouteOverlayView({ entry }) {
|
|
376
|
+
const offsets = entry.scrollOffsets;
|
|
377
|
+
const routeTransitionX = entry.routeTransitionX;
|
|
378
|
+
const scrollTransformStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
379
|
+
let scrollY = 0;
|
|
380
|
+
if (offsets) {
|
|
381
|
+
for (let index = 0; index < offsets.length; index += 1) {
|
|
382
|
+
scrollY += offsets[index].value;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return {
|
|
386
|
+
transform: [
|
|
387
|
+
{ translateX: routeTransitionX?.value ?? 0 },
|
|
388
|
+
{ translateY: -scrollY },
|
|
389
|
+
],
|
|
390
|
+
};
|
|
391
|
+
}, [offsets, routeTransitionX]);
|
|
392
|
+
const hasScrollOrRoute = (offsets != null && offsets.length > 0) || routeTransitionX != null;
|
|
393
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "box-none", style: [react_native_1.StyleSheet.absoluteFill, entry.style, { zIndex: entry.zIndex }], children: entry.frame ? ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "box-none", style: [
|
|
394
|
+
{ position: 'absolute', left: entry.frame.x, top: entry.frame.y, width: entry.frame.width, height: entry.frame.height },
|
|
395
|
+
hasScrollOrRoute ? scrollTransformStyle : undefined,
|
|
396
|
+
entry.portalOffsetStyle,
|
|
397
|
+
], children: entry.children })) : entry.children }));
|
|
398
|
+
});
|
|
399
|
+
const PortalGlassSurface = react_1.default.memo(function PortalGlassSurface({ providerId, entry, drawOrder, shaderEnabled }) {
|
|
400
|
+
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
401
|
+
const opticalProgress = entry.opticalProgress;
|
|
402
|
+
const pointerEvent = entry.pointerEvent;
|
|
403
|
+
const pointerEventValue = entry.pointerEventValue;
|
|
404
|
+
const pointerEventSink = entry.pointerEventSink;
|
|
405
|
+
const valueEvent = entry.valueEvent;
|
|
406
|
+
const valueEventSink = entry.valueEventSink;
|
|
407
|
+
const opticalToggleFraction = entry.opticalToggleFraction;
|
|
408
|
+
const opticalProgressValue = entry.opticalProgressValue;
|
|
409
|
+
const opticalPointX = entry.opticalPointX;
|
|
410
|
+
const opticalPointY = entry.opticalPointY;
|
|
411
|
+
const opticalVelocityX = entry.opticalVelocityX;
|
|
412
|
+
const opticalVelocityY = entry.opticalVelocityY;
|
|
413
|
+
const opticalMotionX = entry.opticalMotionX;
|
|
414
|
+
const opticalMotionY = entry.opticalMotionY;
|
|
415
|
+
const hasAnimatedOptics = Boolean(opticalPointX || opticalPointY || opticalVelocityX || opticalVelocityY ||
|
|
416
|
+
opticalProgressValue != null || opticalProgress || opticalToggleFraction ||
|
|
417
|
+
opticalMotionX || opticalMotionY);
|
|
418
|
+
const animatedOptics = (0, react_native_reanimated_1.useAnimatedProps)(() => ({
|
|
419
|
+
interactionVelocityX: opticalVelocityX?.value,
|
|
420
|
+
interactionVelocityY: opticalVelocityY?.value,
|
|
421
|
+
interactionPointX: opticalPointX?.value,
|
|
422
|
+
interactionPointY: opticalPointY?.value,
|
|
423
|
+
interactionProgress: opticalProgressValue ?? opticalProgress?.value ?? 0,
|
|
424
|
+
toggleFraction: opticalToggleFraction?.value ?? 0,
|
|
425
|
+
motionX: opticalMotionX ? Math.max(-1, Math.min(1, opticalMotionX.value / 1800)) : undefined,
|
|
426
|
+
motionY: opticalMotionY ? Math.max(-1, Math.min(1, opticalMotionY.value / 1800)) : undefined,
|
|
427
|
+
}), [opticalPointX, opticalPointY, opticalVelocityX, opticalVelocityY, opticalProgress, pointerEventValue, valueEvent, opticalToggleFraction, opticalProgressValue, opticalMotionX, opticalMotionY]);
|
|
428
|
+
if (!runtime)
|
|
429
|
+
return null;
|
|
430
|
+
const { tokens, dark, reducedMotion } = runtime;
|
|
431
|
+
// Backdrop glass is drawn in a sibling overlay, above the actual control.
|
|
432
|
+
// Some native render backends still participate in Android hit testing even
|
|
433
|
+
// with pointerEvents="none" on the native view itself, so make the whole
|
|
434
|
+
// portal subtree untargetable for passive lenses. Keep box-none where its
|
|
435
|
+
// React content or an explicitly interactive surface needs to receive input.
|
|
436
|
+
const portalPointerEvents = entry.interactive || entry.portalContent || entry.contentAboveGlass
|
|
437
|
+
? 'box-none'
|
|
438
|
+
: 'none';
|
|
439
|
+
const material = entry.materialOverrides
|
|
440
|
+
? { ...tokens.materials[entry.variant], ...entry.materialOverrides }
|
|
441
|
+
: tokens.materials[entry.variant];
|
|
442
|
+
const qualityScale = material.opticsModel === 'referenceParity'
|
|
443
|
+
? 1
|
|
444
|
+
: tokens.quality === 'high' ? 1.2 : tokens.quality === 'fallback' ? 0.45 : 1;
|
|
445
|
+
if (!shaderEnabled)
|
|
446
|
+
return (0, jsx_runtime_1.jsx)(PortalFallbackSurface, { entry: entry });
|
|
447
|
+
const nativeSurface = ((0, jsx_runtime_1.jsx)(NativeBackdropSurface, { providerId: providerId, sharedPassZIndex: entry.zIndex, sharedPassOrder: drawOrder, opticsModel: material.opticsModel, shapeMaskText: entry.shapeMaskText, shapeMaskFontSize: entry.shapeMaskFontSize, shapeMaskFontWeight: entry.shapeMaskFontWeight, progressiveBlurIntensity: entry.progressiveBlurIntensity, depthEffect: material.referenceDepthEffect ?? false, highlightStyle: material.referenceHighlightStyle, interactionProfile: material.referenceInteractionProfile, contentScaleX: material.referenceContentScaleX, contentScaleY: material.referenceContentScaleY, sampleOffsetX: material.referenceSampleOffsetX, sampleOffsetY: material.referenceSampleOffsetY, toggleTrackColorOff: material.referenceToggleTrackColorOff, toggleTrackColorOn: material.referenceToggleTrackColorOn, toggleTrackWidth: material.referenceToggleTrackWidth, toggleTrackHeight: material.referenceToggleTrackHeight, toggleSolidBackdropColor: material.referenceToggleSolidBackdropColor, brightness: material.brightness ?? 0, contrast: material.contrast ?? 1, highlightFalloff: material.highlightFalloff ?? 1, sdfContrast: material.sdfScaleLens?.contrast, sdfBrightness: material.sdfScaleLens?.brightness, sdfSaturation: material.sdfScaleLens?.saturation, sdfOuterShadowAlpha: material.sdfScaleLens?.outerShadowAlpha, sdfOuterShadowBlurRadius: material.sdfScaleLens?.outerShadowBlurRadius, sdfOuterShadowOffsetY: material.sdfScaleLens?.outerShadowOffsetY, sdfInnerShadowAlpha: material.sdfScaleLens?.innerShadowAlpha, sdfInnerShadowExtent: material.sdfScaleLens?.innerShadowExtent, cornerRadius: material.radius, blurRadius: material.blurRadius * qualityScale, refractionHeight: material.refractionHeight * qualityScale, refractionAmount: material.refractionAmount * qualityScale, bodyRefractionAmount: (material.refractionBodyAmount ?? 2.5) * qualityScale, interactionProgress: opticalProgressValue ?? 0,
|
|
448
|
+
// The pointer stream must be a real prop, not only an animated one:
|
|
449
|
+
// Reanimated's animatedProps path does not reach an Expo Modules view's
|
|
450
|
+
// prop setter, so a gesture sent only there is silently dropped and the
|
|
451
|
+
// native driver never sees a single event.
|
|
452
|
+
pointerEvent: entry.pointerEventValue, pointerEventSink: pointerEventSink, valueEvent: entry.valueEvent, valueEventSink: valueEventSink, saturation: material.saturation, chromaticAberration: material.opticsModel === 'referenceParity' || tokens.quality === 'high' || entry.variant === 'tabSelectionLens'
|
|
453
|
+
? material.chromaticAberration
|
|
454
|
+
: 0, highlightAlpha: material.highlightAlpha, highlightWidth: material.highlightWidth, lightAngle: material.highlightAngle ?? 45, highlightColor: material.highlightColor ? (dark ? material.highlightColor.dark : material.highlightColor.light) : undefined, tintAlpha: material.tintAlpha ?? 1, specularStrength: material.specularStrength ?? 1, fresnelStrength: material.fresnelStrength ?? 0.85, innerShadowStrength: material.innerShadowStrength ?? (material.opticsModel === 'referenceParity' ? 0 : 0.18), shadowOpacity: material.shadowOpacity ?? (material.opticsModel === 'referenceParity' ? 0 : 0.1), shadowRadius: material.shadowRadius ?? (material.opticsModel === 'referenceParity' ? 0 : 24), shadowOffsetY: material.shadowOffsetY ?? (material.opticsModel === 'referenceParity' ? 0 : 4), tint: entry.tintColor ?? (dark ? tokens.tint.dark : tokens.tint.light), surfaceColor: material.surfaceColor ? (dark ? material.surfaceColor.dark : material.surfaceColor.light) : undefined, interactive: entry.interactive && tokens.interaction.enabled && !reducedMotion, pointerEvents: entry.interactive && tokens.interaction.enabled && !reducedMotion ? 'auto' : 'none', continuous: entry.continuous, sharedSource: entry.sharedSource, captureProbe: entry.captureProbe, motionX: undefined, motionY: undefined, displacementOnlyDebug: entry.displacementOnlyDebug, syncContentTransform: entry.syncContentTransform, animatedProps: hasAnimatedOptics ? animatedOptics : undefined, style: [
|
|
455
|
+
styles.nativeSurface,
|
|
456
|
+
entry.placement === 'layout'
|
|
457
|
+
? react_native_1.StyleSheet.absoluteFill
|
|
458
|
+
: { width: entry.frame.width > 0 ? entry.frame.width : undefined },
|
|
459
|
+
{ borderRadius: material.radius },
|
|
460
|
+
] }));
|
|
461
|
+
if (entry.placement === 'bottom' || entry.placement === 'center') {
|
|
462
|
+
const hasMotion = entry.animatedStyle != null || entry.portalOffsetStyle != null;
|
|
463
|
+
if (!hasMotion) {
|
|
464
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: portalPointerEvents, style: [
|
|
465
|
+
react_native_1.StyleSheet.absoluteFill,
|
|
466
|
+
entry.placement === 'center' ? styles.centerPlacement : styles.bottomPlacement,
|
|
467
|
+
entry.placement === 'bottom' && entry.bottomInset != null ? { paddingBottom: entry.bottomInset } : undefined,
|
|
468
|
+
], children: nativeSurface }));
|
|
469
|
+
}
|
|
470
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: portalPointerEvents, style: [
|
|
471
|
+
react_native_1.StyleSheet.absoluteFill,
|
|
472
|
+
entry.placement === 'center' ? styles.centerPlacement : styles.bottomPlacement,
|
|
473
|
+
entry.placement === 'bottom' && entry.bottomInset != null ? { paddingBottom: entry.bottomInset } : undefined,
|
|
474
|
+
entry.animatedStyle,
|
|
475
|
+
entry.portalOffsetStyle,
|
|
476
|
+
], children: nativeSurface }));
|
|
477
|
+
}
|
|
478
|
+
const portalContent = entry.portalContent && entry.placement === 'layout' ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [react_native_1.StyleSheet.absoluteFill, styles.portalContentOverlay, { borderRadius: material.radius }], children: entry.portalContent })) : null;
|
|
479
|
+
const innerContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [nativeSurface, entry.contentAboveGlass && entry.content ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: [react_native_1.StyleSheet.absoluteFill, { borderRadius: material.radius }, styles.contentAboveGlass], children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: entry.contentStyle, children: entry.content }) })) : null, portalContent] }));
|
|
480
|
+
const hasMotion = (entry.positioning === 'floating' && entry.animatedStyle != null) || entry.portalOffsetStyle != null;
|
|
481
|
+
if (!hasMotion) {
|
|
482
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: portalPointerEvents, collapsable: !entry.syncContentTransform, style: [
|
|
483
|
+
styles.portalSurface,
|
|
484
|
+
{ left: entry.frame.x, top: entry.frame.y, width: entry.frame.width, height: entry.frame.height },
|
|
485
|
+
], children: innerContent }));
|
|
486
|
+
}
|
|
487
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: portalPointerEvents, collapsable: !entry.syncContentTransform, style: [
|
|
488
|
+
styles.portalSurface,
|
|
489
|
+
{ left: entry.frame.x, top: entry.frame.y, width: entry.frame.width, height: entry.frame.height },
|
|
490
|
+
entry.positioning === 'floating' ? entry.animatedStyle : undefined,
|
|
491
|
+
entry.portalOffsetStyle,
|
|
492
|
+
], children: innerContent }));
|
|
493
|
+
});
|
|
494
|
+
const PortalFallbackSurface = react_1.default.memo(function PortalFallbackSurface({ entry }) {
|
|
495
|
+
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
496
|
+
if (!runtime)
|
|
497
|
+
return null;
|
|
498
|
+
const { tokens, dark } = runtime;
|
|
499
|
+
const portalPointerEvents = entry.interactive || entry.portalContent || entry.contentAboveGlass
|
|
500
|
+
? 'box-none'
|
|
501
|
+
: 'none';
|
|
502
|
+
const material = tokens.materials[entry.variant];
|
|
503
|
+
const fallbackSurface = ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [
|
|
504
|
+
styles.fallbackSurface,
|
|
505
|
+
entry.placement === 'layout'
|
|
506
|
+
? react_native_1.StyleSheet.absoluteFill
|
|
507
|
+
: { width: entry.frame.width > 0 ? entry.frame.width : undefined },
|
|
508
|
+
{
|
|
509
|
+
backgroundColor: dark ? tokens.fallbackTint.dark : tokens.fallbackTint.light,
|
|
510
|
+
borderColor: dark ? tokens.fallbackBorder.dark : tokens.fallbackBorder.light,
|
|
511
|
+
borderRadius: material.radius,
|
|
512
|
+
},
|
|
513
|
+
] }));
|
|
514
|
+
if (entry.placement === 'bottom' || entry.placement === 'center') {
|
|
515
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: portalPointerEvents, style: [
|
|
516
|
+
react_native_1.StyleSheet.absoluteFill,
|
|
517
|
+
entry.placement === 'center' ? styles.centerPlacement : styles.bottomPlacement,
|
|
518
|
+
entry.placement === 'bottom' && entry.bottomInset != null ? { paddingBottom: entry.bottomInset } : undefined,
|
|
519
|
+
entry.animatedStyle,
|
|
520
|
+
entry.portalOffsetStyle,
|
|
521
|
+
], children: fallbackSurface }));
|
|
522
|
+
}
|
|
523
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: portalPointerEvents, style: [
|
|
524
|
+
styles.portalSurface,
|
|
525
|
+
{ left: entry.frame.x, top: entry.frame.y, width: entry.frame.width, height: entry.frame.height },
|
|
526
|
+
entry.animatedStyle,
|
|
527
|
+
entry.portalOffsetStyle,
|
|
528
|
+
], children: fallbackSurface }));
|
|
529
|
+
});
|
|
530
|
+
/** Theme-driven glass material. Callers select a role; all optical settings live in AppTheme. */
|
|
531
|
+
exports.GlassSurface = react_1.default.memo(function GlassSurface({ variant = 'surface', surfaceRole = 'staticGroup', positioning, sampling, samplingSource, tintColor, portalContent, portalInteractionContent, contentPlacement = 'inFlow', measurementContent, inlineBackdrop, intrinsicInlineBackdrop = false, renderMode, pointerEvents, interactive = false, continuous = false, sharedSource = false, captureProbe = false, opticalProgress, pointerEvent, pointerEventValue, pointerEventSink, valueEvent, valueEventSink, opticalToggleFraction, opticalProgressValue, opticalPointX, opticalPointY, opticalVelocityX, opticalVelocityY, opticalMotionX, opticalMotionY, fallbackAnimatedStyle, materialOverrides, shapeMaskText, shapeMaskFontSize = 0, shapeMaskFontWeight = 700, progressiveBlurIntensity = 0, displacementOnlyDebug = false, syncContentTransform = false, providerIdOverride = null, style, contentStyle, onLayout: onLayoutProp, animatedStyle, portalTranslateX, portalTranslateY, portalScaleX, portalScaleY, placement = 'layout', bottomInset, zIndex = 1, children, frameOverride, }) {
|
|
532
|
+
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
533
|
+
const host = (0, react_1.useContext)(GlassHostContext);
|
|
534
|
+
const captureSourceProviderId = (0, react_1.useContext)(GlassCaptureSourceContext);
|
|
535
|
+
const scopeActive = (0, react_1.useContext)(GlassScopeActiveContext);
|
|
536
|
+
const routeTransitionX = (0, react_1.useContext)(GlassRouteTransitionContext);
|
|
537
|
+
const portalScroll = (0, react_1.useContext)(GlassPortalScrollContext);
|
|
538
|
+
const measureOnly = (0, react_1.useContext)(GlassMeasureOnlyContext);
|
|
539
|
+
const hasPortalMotion = portalTranslateX != null || portalTranslateY != null || portalScaleX != null || portalScaleY != null;
|
|
540
|
+
const portalOffsetStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
541
|
+
transform: [
|
|
542
|
+
...(portalTranslateX ? [{ translateX: portalTranslateX.value }] : []),
|
|
543
|
+
...(portalTranslateY ? [{ translateY: portalTranslateY.value }] : []),
|
|
544
|
+
...(portalScaleX ? [{ scaleX: portalScaleX.value }] : []),
|
|
545
|
+
...(portalScaleY ? [{ scaleY: portalScaleY.value }] : []),
|
|
546
|
+
],
|
|
547
|
+
}), [portalTranslateX, portalTranslateY, portalScaleX, portalScaleY]);
|
|
548
|
+
const resolvedPositioning = positioning ?? (renderMode === 'backdrop' ? 'floating' : 'inFlow');
|
|
549
|
+
const themeMaterial = runtime?.tokens.materials[variant];
|
|
550
|
+
const referenceParity = themeMaterial?.opticsModel === 'referenceParity';
|
|
551
|
+
// Sampling and optics are independent. An explicit `sampling` prop always wins;
|
|
552
|
+
// opticsModel only supplies the default for surfaces that never expressed a
|
|
553
|
+
// preference. Before 2026-11-15 a referenceParity material silently promoted
|
|
554
|
+
// every local surface into a real backdrop consumer, which overrode Hyper UI's
|
|
555
|
+
// `sampling="local"` cards and made the local strategy unreachable.
|
|
556
|
+
const resolvedSampling = sampling ?? (renderMode ?? (referenceParity
|
|
557
|
+
? 'backdrop'
|
|
558
|
+
: resolvedPositioning === 'floating' ? 'backdrop' : 'local'));
|
|
559
|
+
const resolvedSamplingSource = samplingSource ?? host?.defaultSamplingSource ?? 'routeScene';
|
|
560
|
+
const resolvedSamplingProviderId = providerIdOverride != null
|
|
561
|
+
? providerIdOverride
|
|
562
|
+
: resolvedSamplingSource === 'themeBackdrop'
|
|
563
|
+
? host?.themeBackdropProviderId
|
|
564
|
+
: captureSourceProviderId ?? host?.routeSceneProviderId ?? host?.themeBackdropProviderId;
|
|
565
|
+
// A routeScene provider records route content. Keep its consumers outside
|
|
566
|
+
// that source tree or the RenderNode can sample itself recursively.
|
|
567
|
+
// Inline rendering remains valid when it samples the separate theme
|
|
568
|
+
// backdrop provider (including the routeScene fallback without a scope)
|
|
569
|
+
// or an explicit parent/underlay providerIdOverride outside the inner capture scope.
|
|
570
|
+
const samplesOwnCaptureSource = captureSourceProviderId !== null && (providerIdOverride != null
|
|
571
|
+
? providerIdOverride === captureSourceProviderId
|
|
572
|
+
: resolvedSamplingSource === 'routeScene');
|
|
573
|
+
// With a separate `backdrop` the route tree is already a sibling above the
|
|
574
|
+
// capture source, so an in-flow surface can sample it directly through the
|
|
575
|
+
// inline path. That removes the per-surface measureInWindow bridge round
|
|
576
|
+
// trips, the portal re-render and the duplicate hidden measure tree.
|
|
577
|
+
const flatSurfaceStyle = react_native_1.StyleSheet.flatten(style);
|
|
578
|
+
const autoInlineBackdrop = inlineBackdrop === undefined &&
|
|
579
|
+
host?.hasSeparateBackdrop === true &&
|
|
580
|
+
!samplesOwnCaptureSource &&
|
|
581
|
+
resolvedPositioning === 'inFlow' &&
|
|
582
|
+
placement === 'layout' &&
|
|
583
|
+
portalContent == null &&
|
|
584
|
+
portalInteractionContent == null &&
|
|
585
|
+
frameOverride == null &&
|
|
586
|
+
zIndex <= 1 &&
|
|
587
|
+
!hasPortalMotion;
|
|
588
|
+
const resolvedInlineBackdrop = (inlineBackdrop ?? (autoInlineBackdrop || host?.inlineBackdropByDefault === true)) &&
|
|
589
|
+
!samplesOwnCaptureSource;
|
|
590
|
+
const resolvedIntrinsicInlineBackdrop = intrinsicInlineBackdrop ||
|
|
591
|
+
(autoInlineBackdrop && typeof flatSurfaceStyle?.height !== 'number');
|
|
592
|
+
const contentAboveGlass = contentPlacement === 'aboveGlass' && resolvedSampling === 'backdrop';
|
|
593
|
+
const resolvedRenderMode = runtime?.tokens.enabled && resolvedSampling === 'backdrop' && react_native_1.Platform.OS === 'android' && host && runtime.tokens.quality !== 'fallback'
|
|
594
|
+
? 'backdrop'
|
|
595
|
+
: 'local';
|
|
596
|
+
const id = (0, react_1.useId)();
|
|
597
|
+
const viewRef = (0, react_1.useRef)(null);
|
|
598
|
+
const [frame, setFrame] = (0, react_1.useState)(null);
|
|
599
|
+
const measure = (0, react_1.useCallback)(() => {
|
|
600
|
+
if (resolvedInlineBackdrop)
|
|
601
|
+
return;
|
|
602
|
+
const view = viewRef.current;
|
|
603
|
+
const hostNode = host?.hostRef.current;
|
|
604
|
+
if (!view || !hostNode)
|
|
605
|
+
return;
|
|
606
|
+
if ((0, react_native_1.findNodeHandle)(view) == null || (0, react_native_1.findNodeHandle)(hostNode) == null)
|
|
607
|
+
return;
|
|
608
|
+
// Native-stack/Fabric can place a route view in a different native
|
|
609
|
+
// branch from the app-level glass host. measureLayout requires a true
|
|
610
|
+
// native ancestor and silently loses the surface when that is false.
|
|
611
|
+
// Same-window coordinates work across those branches and map directly
|
|
612
|
+
// to the full-screen sibling overlay.
|
|
613
|
+
view.measureInWindow((viewX, viewY, width, height) => {
|
|
614
|
+
hostNode.measureInWindow((hostX, hostY) => {
|
|
615
|
+
// measureInWindow includes the route container's transform.
|
|
616
|
+
// Keep the registered base frame untransformed, then apply that
|
|
617
|
+
// same shared value to the host-level glass overlay below.
|
|
618
|
+
const scrollOffsetY = portalScroll.offsets.reduce((offset, value) => offset + value.value, 0);
|
|
619
|
+
const next = {
|
|
620
|
+
x: viewX - hostX - (routeTransitionX?.value ?? 0),
|
|
621
|
+
y: viewY - hostY + scrollOffsetY,
|
|
622
|
+
width,
|
|
623
|
+
height,
|
|
624
|
+
};
|
|
625
|
+
setFrame((current) => current && current.x === next.x && current.y === next.y && current.width === width && current.height === height
|
|
626
|
+
? current
|
|
627
|
+
: next);
|
|
628
|
+
});
|
|
629
|
+
});
|
|
630
|
+
}, [host, portalScroll.offsets, routeTransitionX, resolvedInlineBackdrop]);
|
|
631
|
+
const onLayout = (0, react_1.useCallback)((event) => {
|
|
632
|
+
measure();
|
|
633
|
+
onLayoutProp?.(event);
|
|
634
|
+
}, [measure, onLayoutProp]);
|
|
635
|
+
(0, react_1.useEffect)(() => {
|
|
636
|
+
measure();
|
|
637
|
+
}, [measure, portalScroll.layoutRevision]);
|
|
638
|
+
(0, react_1.useEffect)(() => () => host?.remove(id), [host, id]);
|
|
639
|
+
(0, react_1.useEffect)(() => {
|
|
640
|
+
if (!host)
|
|
641
|
+
return;
|
|
642
|
+
if (measureOnly || !scopeActive || !runtime?.tokens.enabled || resolvedRenderMode !== 'backdrop' || resolvedInlineBackdrop || !frame || frame.width <= 0 || frame.height <= 0) {
|
|
643
|
+
host.remove(id);
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
const publishedFrame = frameOverride
|
|
647
|
+
? { x: frameOverride.x, y: frameOverride.y, width: frameOverride.width, height: frameOverride.height }
|
|
648
|
+
: frame;
|
|
649
|
+
host.updateSurface(id, {
|
|
650
|
+
frame: publishedFrame,
|
|
651
|
+
positioning: resolvedPositioning,
|
|
652
|
+
samplingSource: resolvedSamplingSource,
|
|
653
|
+
captureProbe,
|
|
654
|
+
samplingProviderId: resolvedSamplingProviderId ?? host.themeBackdropProviderId,
|
|
655
|
+
tintColor,
|
|
656
|
+
portalContent,
|
|
657
|
+
contentAboveGlass: contentAboveGlass && resolvedRenderMode === 'backdrop' && !resolvedInlineBackdrop,
|
|
658
|
+
sharedSource,
|
|
659
|
+
content: contentAboveGlass ? children : undefined,
|
|
660
|
+
contentStyle: contentAboveGlass ? contentStyle : undefined,
|
|
661
|
+
variant,
|
|
662
|
+
interactive,
|
|
663
|
+
continuous,
|
|
664
|
+
opticalProgress,
|
|
665
|
+
scrollGroupKey: portalScroll.offsets.length > 0 ? portalScroll.groupKey : '',
|
|
666
|
+
scrollOffsets: portalScroll.offsets,
|
|
667
|
+
routeTransitionX,
|
|
668
|
+
portalOffsetStyle: hasPortalMotion ? portalOffsetStyle : undefined,
|
|
669
|
+
portalTranslateX,
|
|
670
|
+
portalTranslateY,
|
|
671
|
+
portalScaleX,
|
|
672
|
+
portalScaleY,
|
|
673
|
+
pointerEvent,
|
|
674
|
+
pointerEventValue,
|
|
675
|
+
pointerEventSink,
|
|
676
|
+
valueEvent,
|
|
677
|
+
valueEventSink,
|
|
678
|
+
opticalToggleFraction,
|
|
679
|
+
opticalProgressValue,
|
|
680
|
+
opticalPointX,
|
|
681
|
+
opticalPointY,
|
|
682
|
+
opticalVelocityX,
|
|
683
|
+
opticalVelocityY,
|
|
684
|
+
opticalMotionX,
|
|
685
|
+
opticalMotionY,
|
|
686
|
+
materialOverrides,
|
|
687
|
+
shapeMaskText,
|
|
688
|
+
shapeMaskFontSize,
|
|
689
|
+
shapeMaskFontWeight,
|
|
690
|
+
progressiveBlurIntensity,
|
|
691
|
+
displacementOnlyDebug,
|
|
692
|
+
syncContentTransform,
|
|
693
|
+
animatedStyle,
|
|
694
|
+
placement,
|
|
695
|
+
bottomInset,
|
|
696
|
+
zIndex,
|
|
697
|
+
});
|
|
698
|
+
if (portalInteractionContent) {
|
|
699
|
+
host.updateOverlay(id, {
|
|
700
|
+
children: portalInteractionContent,
|
|
701
|
+
frame: publishedFrame,
|
|
702
|
+
scrollOffsets: portalScroll.offsets.length > 0 ? portalScroll.offsets : undefined,
|
|
703
|
+
routeTransitionX,
|
|
704
|
+
portalOffsetStyle: hasPortalMotion ? portalOffsetStyle : undefined,
|
|
705
|
+
zIndex: 10000 + zIndex,
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
host.removeOverlay(id);
|
|
710
|
+
}
|
|
711
|
+
}, [measureOnly, scopeActive, runtime?.tokens.enabled, resolvedRenderMode, resolvedInlineBackdrop, host, id, frame, frameOverride, resolvedPositioning, resolvedSamplingSource, resolvedSamplingProviderId, tintColor, portalContent, portalInteractionContent, contentAboveGlass, children, variant, interactive, continuous, sharedSource, captureProbe, opticalProgress, routeTransitionX, portalScroll.offsets, portalScroll.groupKey, hasPortalMotion, portalOffsetStyle, portalTranslateX, portalTranslateY, portalScaleX, portalScaleY, pointerEvent, pointerEventValue, pointerEventSink, valueEvent, valueEventSink, opticalToggleFraction, opticalProgressValue, opticalPointX, opticalPointY, opticalVelocityX, opticalVelocityY, opticalMotionX, opticalMotionY, materialOverrides, shapeMaskText, shapeMaskFontSize, shapeMaskFontWeight, progressiveBlurIntensity, displacementOnlyDebug, syncContentTransform, animatedStyle, placement, bottomInset, zIndex]);
|
|
712
|
+
if (measureOnly) {
|
|
713
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: style, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: resolvedInlineBackdrop ? (resolvedIntrinsicInlineBackdrop ? styles.inlineBackdropIntrinsicSurface : styles.inlineBackdropSurface) : undefined, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [contentAboveGlass || resolvedIntrinsicInlineBackdrop ? styles.portalContentIntrinsic : placement === 'layout' ? styles.portalContentLayout : styles.portalContentWrap, contentStyle], children: children }) }) }));
|
|
714
|
+
}
|
|
715
|
+
if (!runtime?.tokens.enabled) {
|
|
716
|
+
return (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [style, animatedStyle, hasPortalMotion ? portalOffsetStyle : undefined, fallbackAnimatedStyle], children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: contentStyle, children: children }) });
|
|
717
|
+
}
|
|
718
|
+
// Keep inline renderers and their foreground subtrees mounted across page
|
|
719
|
+
// activation. Replacing this branch with LocalGlassSurface rebuilt text,
|
|
720
|
+
// gestures and native renderers on every tab selection. Hidden native
|
|
721
|
+
// lenses are INVISIBLE; portaled surfaces still unpublish below so another
|
|
722
|
+
// page can never paint a hidden page's pill.
|
|
723
|
+
// The inline path samples a provider id directly and needs no host, so it must
|
|
724
|
+
// be checked before the host guard. Ordered the other way, a provider that
|
|
725
|
+
// supplies no backdrop recorder could never reach its own inline material:
|
|
726
|
+
// every surface fell through to the local renderer and no native view, no
|
|
727
|
+
// motion driver and no press animation was ever created.
|
|
728
|
+
if (resolvedInlineBackdrop) {
|
|
729
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: pointerEvents, onLayout: onLayoutProp, style: [style, animatedStyle, hasPortalMotion ? portalOffsetStyle : undefined], children: (0, jsx_runtime_1.jsx)(InlineBackdropSurface, { renderingEnabled: scopeActive, providerId: resolvedSamplingProviderId ?? '', variant: variant, tintColor: tintColor, interactive: interactive, continuous: continuous, sharedSource: sharedSource, captureProbe: captureProbe, opticalProgress: opticalProgress, pointerEvent: pointerEvent, pointerEventValue: pointerEventValue, pointerEventSink: pointerEventSink, valueEventSink: valueEventSink, valueEvent: valueEvent, opticalToggleFraction: opticalToggleFraction, opticalPointX: opticalPointX, opticalPointY: opticalPointY, opticalVelocityX: opticalVelocityX, opticalVelocityY: opticalVelocityY, opticalMotionX: opticalMotionX, opticalMotionY: opticalMotionY, materialOverrides: materialOverrides, displacementOnlyDebug: displacementOnlyDebug, syncContentTransform: syncContentTransform, intrinsicLayout: resolvedIntrinsicInlineBackdrop, contentStyle: contentStyle, placement: placement, children: children }) }));
|
|
730
|
+
}
|
|
731
|
+
if (resolvedRenderMode === 'local' || !host || !scopeActive) {
|
|
732
|
+
return ((0, jsx_runtime_1.jsx)(LocalGlassSurface, { variant: variant, surfaceRole: surfaceRole, style: style, contentStyle: contentStyle, animatedStyle: hasPortalMotion ? portalOffsetStyle : animatedStyle, fallbackAnimatedStyle: fallbackAnimatedStyle, pointerEvents: pointerEvents, onLayout: onLayout, children: children }));
|
|
733
|
+
}
|
|
734
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { ref: viewRef, collapsable: false, pointerEvents: pointerEvents, onLayout: onLayout, style: [style, animatedStyle, styles.measureOnly], children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [contentAboveGlass ? styles.portalContentIntrinsic : placement === 'layout' ? styles.portalContentLayout : styles.portalContentWrap, contentStyle], children: contentAboveGlass ? (
|
|
735
|
+
// The visible copy lives in the overlay; this one only exists
|
|
736
|
+
// so a content-sized surface still measures. alpha 0 keeps it
|
|
737
|
+
// out of the recorded scene, which is the whole point.
|
|
738
|
+
(0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.contentAboveGlassMeasure, { opacity: 0 }], children: (0, jsx_runtime_1.jsx)(GlassMeasureOnlyContext.Provider, { value: true, children: measurementContent ?? children }) })) : children }) }));
|
|
739
|
+
});
|
|
740
|
+
const InlineBackdropSurface = react_1.default.memo(function InlineBackdropSurface({ renderingEnabled, providerId, variant, tintColor, interactive, continuous, sharedSource, captureProbe, opticalProgress, pointerEvent, pointerEventValue, pointerEventSink, valueEventSink, valueEvent, opticalToggleFraction, opticalPointX, opticalPointY, opticalVelocityX, opticalVelocityY, opticalMotionX, opticalMotionY, materialOverrides, displacementOnlyDebug, syncContentTransform, intrinsicLayout, contentStyle, placement, children, }) {
|
|
741
|
+
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
742
|
+
const hasAnimatedOptics = Boolean(opticalPointX || opticalPointY || opticalVelocityX || opticalVelocityY ||
|
|
743
|
+
opticalProgress || opticalToggleFraction || opticalMotionX || opticalMotionY);
|
|
744
|
+
const animatedOptics = (0, react_native_reanimated_1.useAnimatedProps)(() => ({
|
|
745
|
+
interactionVelocityX: opticalVelocityX?.value,
|
|
746
|
+
interactionVelocityY: opticalVelocityY?.value,
|
|
747
|
+
interactionPointX: opticalPointX?.value,
|
|
748
|
+
interactionPointY: opticalPointY?.value,
|
|
749
|
+
interactionProgress: opticalProgress?.value ?? 0,
|
|
750
|
+
toggleFraction: opticalToggleFraction?.value ?? 0,
|
|
751
|
+
motionX: opticalMotionX ? Math.max(-1, Math.min(1, opticalMotionX.value / 1800)) : undefined,
|
|
752
|
+
motionY: opticalMotionY ? Math.max(-1, Math.min(1, opticalMotionY.value / 1800)) : undefined,
|
|
753
|
+
}), [opticalPointX, opticalPointY, opticalVelocityX, opticalVelocityY, opticalProgress, pointerEventValue, valueEvent, opticalToggleFraction, opticalMotionX, opticalMotionY]);
|
|
754
|
+
if (!runtime)
|
|
755
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
756
|
+
const { tokens, dark, reducedMotion } = runtime;
|
|
757
|
+
const material = materialOverrides
|
|
758
|
+
? { ...tokens.materials[variant], ...materialOverrides }
|
|
759
|
+
: tokens.materials[variant];
|
|
760
|
+
const qualityScale = material.opticsModel === 'referenceParity'
|
|
761
|
+
? 1
|
|
762
|
+
: tokens.quality === 'high' ? 1.2 : tokens.quality === 'fallback' ? 0.45 : 1;
|
|
763
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { collapsable: !syncContentTransform, style: intrinsicLayout ? styles.inlineBackdropIntrinsicSurface : styles.inlineBackdropSurface, children: [(0, jsx_runtime_1.jsx)(NativeBackdropSurface, { renderingEnabled: renderingEnabled, providerId: providerId, opticsModel: material.opticsModel, depthEffect: material.referenceDepthEffect ?? false, highlightStyle: material.referenceHighlightStyle, interactionProfile: material.referenceInteractionProfile, contentScaleX: material.referenceContentScaleX, contentScaleY: material.referenceContentScaleY, sampleOffsetX: material.referenceSampleOffsetX, sampleOffsetY: material.referenceSampleOffsetY, toggleTrackColorOff: material.referenceToggleTrackColorOff, toggleTrackColorOn: material.referenceToggleTrackColorOn, toggleTrackWidth: material.referenceToggleTrackWidth, toggleTrackHeight: material.referenceToggleTrackHeight, toggleSolidBackdropColor: material.referenceToggleSolidBackdropColor, brightness: material.brightness ?? 0, contrast: material.contrast ?? 1, highlightFalloff: material.highlightFalloff ?? 1, sdfContrast: material.sdfScaleLens?.contrast, sdfBrightness: material.sdfScaleLens?.brightness, sdfSaturation: material.sdfScaleLens?.saturation, sdfOuterShadowAlpha: material.sdfScaleLens?.outerShadowAlpha, sdfOuterShadowBlurRadius: material.sdfScaleLens?.outerShadowBlurRadius, sdfOuterShadowOffsetY: material.sdfScaleLens?.outerShadowOffsetY, sdfInnerShadowAlpha: material.sdfScaleLens?.innerShadowAlpha, sdfInnerShadowExtent: material.sdfScaleLens?.innerShadowExtent, cornerRadius: material.radius, blurRadius: material.blurRadius * qualityScale, refractionHeight: material.refractionHeight * qualityScale, refractionAmount: material.refractionAmount * qualityScale, bodyRefractionAmount: (material.refractionBodyAmount ?? 2.5) * qualityScale, interactionProgress: 0, pointerEvent: pointerEventValue, pointerEventSink: pointerEventSink, valueEventSink: valueEventSink, valueEvent: valueEvent, saturation: material.saturation, chromaticAberration: material.opticsModel === 'referenceParity' || tokens.quality === 'high' || variant === 'tabSelectionLens' ? material.chromaticAberration : 0, highlightAlpha: material.highlightAlpha, highlightWidth: material.highlightWidth, lightAngle: material.highlightAngle ?? 45, highlightColor: material.highlightColor ? (dark ? material.highlightColor.dark : material.highlightColor.light) : undefined, tintAlpha: material.tintAlpha ?? 1, specularStrength: material.specularStrength ?? 1, fresnelStrength: material.fresnelStrength ?? 0.85, innerShadowStrength: material.innerShadowStrength ?? (material.opticsModel === 'referenceParity' ? 0 : 0.18), shadowOpacity: material.shadowOpacity ?? (material.opticsModel === 'referenceParity' ? 0 : 0.1), shadowRadius: material.shadowRadius ?? (material.opticsModel === 'referenceParity' ? 0 : 24), shadowOffsetY: material.shadowOffsetY ?? (material.opticsModel === 'referenceParity' ? 0 : 4), tint: tintColor ?? (dark ? tokens.tint.dark : tokens.tint.light), surfaceColor: material.surfaceColor ? (dark ? material.surfaceColor.dark : material.surfaceColor.light) : undefined, interactive: interactive && tokens.interaction.enabled && !reducedMotion, continuous: continuous, sharedSource: sharedSource, captureProbe: captureProbe, displacementOnlyDebug: displacementOnlyDebug, syncContentTransform: syncContentTransform, animatedProps: hasAnimatedOptics ? animatedOptics : undefined, pointerEvents: interactive ? undefined : 'none', style: [react_native_1.StyleSheet.absoluteFill, { borderRadius: material.radius }] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [intrinsicLayout ? styles.portalContentIntrinsic : placement === 'layout' ? styles.portalContentLayout : styles.portalContentWrap, contentStyle], children: children })] }));
|
|
764
|
+
});
|
|
765
|
+
function LocalGlassSurface({ variant, surfaceRole, style, contentStyle, animatedStyle, fallbackAnimatedStyle, pointerEvents, onLayout, children, }) {
|
|
766
|
+
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
767
|
+
if (!runtime?.tokens.enabled)
|
|
768
|
+
return (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { onLayout: onLayout, style: [style, animatedStyle, fallbackAnimatedStyle], children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: contentStyle, children: children }) });
|
|
769
|
+
const { tokens, dark } = runtime;
|
|
770
|
+
const material = tokens.materials[variant ?? 'surface'];
|
|
771
|
+
const fallback = tokens.quality === 'fallback';
|
|
772
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_reanimated_1.default.View, { pointerEvents: pointerEvents, onLayout: onLayout, style: [styles.localSurface, { borderRadius: material.radius, backgroundColor: 'transparent' }, style, animatedStyle, fallbackAnimatedStyle], children: [fallback ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [
|
|
773
|
+
react_native_1.StyleSheet.absoluteFill,
|
|
774
|
+
{
|
|
775
|
+
backgroundColor: dark ? tokens.fallbackTint.dark : tokens.fallbackTint.light,
|
|
776
|
+
borderColor: dark ? tokens.fallbackBorder.dark : tokens.fallbackBorder.light,
|
|
777
|
+
borderWidth: react_native_1.StyleSheet.hairlineWidth,
|
|
778
|
+
borderRadius: material.radius,
|
|
779
|
+
},
|
|
780
|
+
] })) : ((0, jsx_runtime_1.jsx)(LocalGlassMaterial_1.LocalGlassMaterial, { tokens: tokens, material: material, dark: dark, surfaceRole: surfaceRole })), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.localContent, contentStyle], children: children })] }));
|
|
781
|
+
}
|
|
782
|
+
function useGlassProviderId() {
|
|
783
|
+
return (0, react_1.useContext)(GlassHostContext)?.providerId ?? null;
|
|
784
|
+
}
|
|
785
|
+
/** Ref for converting window-measured anchors into the route overlay's local coordinates. */
|
|
786
|
+
function useGlassOverlayHostRef() {
|
|
787
|
+
return (0, react_1.useContext)(GlassHostContext)?.hostRef ?? null;
|
|
788
|
+
}
|
|
789
|
+
/** Route-level view overlay for sheets/dialogs; its children remain ordinary native views. */
|
|
790
|
+
function GlassOverlay({ children, zIndex = 100 }) {
|
|
791
|
+
const runtime = (0, react_1.useContext)(GlassRuntimeContext);
|
|
792
|
+
const host = (0, react_1.useContext)(GlassOverlayHostContext);
|
|
793
|
+
const id = (0, react_1.useId)();
|
|
794
|
+
(0, react_1.useEffect)(() => () => host?.remove(id), [host, id]);
|
|
795
|
+
(0, react_1.useEffect)(() => {
|
|
796
|
+
if (!host)
|
|
797
|
+
return;
|
|
798
|
+
if (runtime?.tokens.enabled)
|
|
799
|
+
host.updateOverlay(id, { children, zIndex });
|
|
800
|
+
else
|
|
801
|
+
host.remove(id);
|
|
802
|
+
}, [runtime?.tokens.enabled, host, id, children, zIndex]);
|
|
803
|
+
if (!runtime?.tokens.enabled || !host)
|
|
804
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
805
|
+
return null;
|
|
806
|
+
}
|
|
807
|
+
const styles = react_native_1.StyleSheet.create({
|
|
808
|
+
root: { flex: 1 },
|
|
809
|
+
routeContent: { ...react_native_1.StyleSheet.flatten(react_native_1.StyleSheet.absoluteFill) },
|
|
810
|
+
measureOnly: {},
|
|
811
|
+
localSurface: { position: 'relative', overflow: 'hidden' },
|
|
812
|
+
// In-flow local surfaces wrap their content by default. A default flex:1
|
|
813
|
+
// makes controls inside a virtualized list header consume the viewport,
|
|
814
|
+
// pushing the actual feed cells below the visible area. Callers that need
|
|
815
|
+
// a filling surface opt into flex through contentStyle.
|
|
816
|
+
localContent: { overflow: 'hidden' },
|
|
817
|
+
portalSurface: { position: 'absolute', overflow: 'visible' },
|
|
818
|
+
portalContentOverlay: { alignItems: 'center', justifyContent: 'center', overflow: 'hidden' },
|
|
819
|
+
contentAboveGlass: { overflow: 'hidden' },
|
|
820
|
+
contentAboveGlassMeasure: { alignSelf: 'stretch' },
|
|
821
|
+
nativeSurface: { backgroundColor: 'transparent', overflow: 'hidden' },
|
|
822
|
+
fallbackSurface: { backgroundColor: 'transparent', borderWidth: react_native_1.StyleSheet.hairlineWidth, overflow: 'hidden' },
|
|
823
|
+
portalContentLayout: { flex: 1, overflow: 'hidden' },
|
|
824
|
+
portalContentWrap: { flexGrow: 1, flexShrink: 1, overflow: 'hidden' },
|
|
825
|
+
portalContentIntrinsic: { alignSelf: 'stretch', overflow: 'hidden' },
|
|
826
|
+
captureSource: { flex: 1 },
|
|
827
|
+
inlineBackdropSurface: { flex: 1 },
|
|
828
|
+
inlineBackdropIntrinsicSurface: { flexGrow: 1 },
|
|
829
|
+
bottomPlacement: { alignItems: 'center', justifyContent: 'flex-end' },
|
|
830
|
+
centerPlacement: { alignItems: 'center', justifyContent: 'center' },
|
|
831
|
+
});
|
|
832
|
+
//# sourceMappingURL=GlassSurface.js.map
|