@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,328 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { memo, useCallback, useMemo, useRef } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
5
|
+
import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withDelay, withSpring } from 'react-native-reanimated';
|
|
6
|
+
import { GlassSurface } from '../GlassSurface';
|
|
7
|
+
import { useGlassKnobMotion } from '../useGlassKnobMotion';
|
|
8
|
+
import { useTheme } from '../theme';
|
|
9
|
+
import { pointerXInView } from '../pointerGeometry';
|
|
10
|
+
import { referenceSliderKnobOffset } from '../fallbackKnobGeometry';
|
|
11
|
+
import { resolveSliderValue } from '../sliderValue';
|
|
12
|
+
const RAIL_HEIGHT = 6;
|
|
13
|
+
const KNOB_WIDTH = 40;
|
|
14
|
+
const KNOB_HEIGHT = 24;
|
|
15
|
+
/** Reference `LiquidSlider`: 0xFF0088FF light, 0xFF0091FF dark. */
|
|
16
|
+
const ACCENT_LIGHT = '#0088FF';
|
|
17
|
+
const ACCENT_DARK = '#0091FF';
|
|
18
|
+
/** Reference rail: 0xFF787878 at 20% light, 0xFF787880 at 36% dark. */
|
|
19
|
+
const RAIL_OFF_LIGHT = 'rgba(120,120,120,0.20)';
|
|
20
|
+
const RAIL_OFF_DARK = 'rgba(120,120,128,0.36)';
|
|
21
|
+
const PRESS_SPRING = { damping: 2 * Math.sqrt(1000), stiffness: 1000, mass: 1 };
|
|
22
|
+
const PRESS_RELEASE_DELAY_MS = 180;
|
|
23
|
+
const EMPTY_KEY_POINTS = [];
|
|
24
|
+
export const GlassSlider = memo(function GlassSlider({ value, defaultValue, onValueChange, onSlidingComplete, min = 0, max = 1, step = 0, showKeyPoints = false, keyPoints = EMPTY_KEY_POINTS, magnetThreshold = .02, disabled = false, style, trackColorOff, trackColorOn, accessibilityLabel, }) {
|
|
25
|
+
const theme = useTheme();
|
|
26
|
+
const isDark = theme.dark;
|
|
27
|
+
const accent = trackColorOn ?? (isDark ? ACCENT_DARK : ACCENT_LIGHT);
|
|
28
|
+
const railOff = trackColorOff ?? (isDark ? RAIL_OFF_DARK : RAIL_OFF_LIGHT);
|
|
29
|
+
const span = max - min;
|
|
30
|
+
const clamp = useCallback((next) => {
|
|
31
|
+
return resolveSliderValue(next, min, max, step);
|
|
32
|
+
}, [min, max, span, step]);
|
|
33
|
+
const controlled = value !== undefined;
|
|
34
|
+
const [internal, setInternal] = React.useState(() => clamp(defaultValue ?? min));
|
|
35
|
+
const current = controlled ? clamp(value) : internal;
|
|
36
|
+
const initialProgress = span > 0 ? (current - min) / span : 0;
|
|
37
|
+
const pendingGestureValue = useRef(null);
|
|
38
|
+
const draggingRef = useRef(false);
|
|
39
|
+
const pressProgress = useSharedValue(0);
|
|
40
|
+
const railProgress = useSharedValue(initialProgress);
|
|
41
|
+
const railWidthShared = useSharedValue(0);
|
|
42
|
+
const gestureFinished = useSharedValue(false);
|
|
43
|
+
const panActivated = useSharedValue(false);
|
|
44
|
+
const didDrag = useSharedValue(false);
|
|
45
|
+
const grabbedKnob = useSharedValue(false);
|
|
46
|
+
const grabOffsetPx = useSharedValue(0);
|
|
47
|
+
const lastDragPx = useSharedValue(0);
|
|
48
|
+
const [railWidth, setRailWidth] = React.useState(0);
|
|
49
|
+
const railRef = useRef(railWidth);
|
|
50
|
+
railRef.current = railWidth;
|
|
51
|
+
const railLeft = useSharedValue(0);
|
|
52
|
+
// The driver needs a value the moment layout produces a track. Emitting from an
|
|
53
|
+
// effect keyed on `travel` is not enough on the first pass: `useGlassKnobMotion`
|
|
54
|
+
// returns a new object every render, and the effect's deps include a value derived
|
|
55
|
+
// from a ref that was still 0 when the gesture captured it. Sending it here makes
|
|
56
|
+
// layout the trigger, which is the event that actually creates the track.
|
|
57
|
+
// The value's position is measured along the whole rail, not along rail-minus-knob.
|
|
58
|
+
// The reference uses one fraction for both the fill width (`maxWidth * progress`)
|
|
59
|
+
// and the knob's centre (`trackWidth * progress`), then clamps the knob's offset so
|
|
60
|
+
// it overhangs each end by a quarter of its own width. Measuring the knob along a
|
|
61
|
+
// shorter range made it lag the fill by up to a knob width — visible as a blue tip
|
|
62
|
+
// poking out past the lens at 83%.
|
|
63
|
+
const travel = railWidth;
|
|
64
|
+
const knob = useGlassKnobMotion(span > 0 ? (current - min) / span : 0, travel);
|
|
65
|
+
const fallbackKnobStyle = useAnimatedStyle(() => {
|
|
66
|
+
return {
|
|
67
|
+
transform: [{ translateX: referenceSliderKnobOffset(knob.fallbackProgress.value, railWidth, KNOB_WIDTH) }],
|
|
68
|
+
};
|
|
69
|
+
}, [knob.fallbackProgress, railWidth]);
|
|
70
|
+
const knobRef = useRef(knob);
|
|
71
|
+
knobRef.current = knob;
|
|
72
|
+
const commit = useCallback((next, fromGesture = false) => {
|
|
73
|
+
if (fromGesture) {
|
|
74
|
+
pendingGestureValue.current = next;
|
|
75
|
+
requestAnimationFrame(() => {
|
|
76
|
+
if (pendingGestureValue.current === next)
|
|
77
|
+
pendingGestureValue.current = null;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (!controlled)
|
|
81
|
+
setInternal(next);
|
|
82
|
+
onValueChange?.(next);
|
|
83
|
+
}, [controlled, onValueChange]);
|
|
84
|
+
const resolve = useCallback((progress) => resolveSliderValue(min + span * progress, min, max, step, keyPoints, magnetThreshold), [min, max, step, span, keyPoints, magnetThreshold]);
|
|
85
|
+
const pageX = useRef(0);
|
|
86
|
+
const railViewRef = useRef(null);
|
|
87
|
+
const onLayout = useCallback((event) => {
|
|
88
|
+
const width = event.nativeEvent.layout.width;
|
|
89
|
+
setRailWidth(width);
|
|
90
|
+
railWidthShared.value = width;
|
|
91
|
+
// RNGH reports `event.x` relative to the view the detector wraps, but on
|
|
92
|
+
// Fabric that view can report the screen coordinate instead. Measuring the
|
|
93
|
+
// window position once lets a local x be derived from either, so the control
|
|
94
|
+
// cannot invert horizontally when the gesture container moves.
|
|
95
|
+
railViewRef.current?.measureInWindow((x) => {
|
|
96
|
+
pageX.current = x;
|
|
97
|
+
railLeft.value = x;
|
|
98
|
+
});
|
|
99
|
+
}, [railLeft, railWidthShared]);
|
|
100
|
+
// Reads the measured width through the ref, not the closure. The gesture callbacks
|
|
101
|
+
// are reassigned every render but the ones a running gesture captured are the ones
|
|
102
|
+
// it calls; a captured `railWidth` from before the first layout is 0, and a guard on
|
|
103
|
+
// 0 returned the minimum for every touch. Measured on device: a tap at 245 of a
|
|
104
|
+
// 313dp rail reported v0.00.
|
|
105
|
+
const valueForPx = useCallback((px) => {
|
|
106
|
+
const width = railRef.current;
|
|
107
|
+
if (width <= 0)
|
|
108
|
+
return min;
|
|
109
|
+
return resolve(px / width);
|
|
110
|
+
}, [min, resolve]);
|
|
111
|
+
/**
|
|
112
|
+
* Local x inside the rail, from an absolute pointer x.
|
|
113
|
+
*
|
|
114
|
+
* `absoluteX` is measured against the window and `pageX` is the rail's own window
|
|
115
|
+
* origin, so the difference is local by construction. `event.x` was tried first and
|
|
116
|
+
* measured wrong on device — it reported values outside the rail's range for a
|
|
117
|
+
* pointer well inside it — which put the value at 0% for every touch on the right
|
|
118
|
+
* half.
|
|
119
|
+
*/
|
|
120
|
+
const localX = useCallback((absolute) => {
|
|
121
|
+
const width = railRef.current;
|
|
122
|
+
if (width <= 0)
|
|
123
|
+
return 0;
|
|
124
|
+
return pointerXInView(absolute, pageX.current, width);
|
|
125
|
+
}, []);
|
|
126
|
+
const valueForPxRef = useRef(valueForPx);
|
|
127
|
+
valueForPxRef.current = valueForPx;
|
|
128
|
+
const commitRef = useRef(commit);
|
|
129
|
+
commitRef.current = commit;
|
|
130
|
+
const onSlidingCompleteRef = useRef(onSlidingComplete);
|
|
131
|
+
onSlidingCompleteRef.current = onSlidingComplete;
|
|
132
|
+
const emitPointer = useCallback((raw) => {
|
|
133
|
+
draggingRef.current = true;
|
|
134
|
+
knobRef.current.begin(localX(raw), Date.now());
|
|
135
|
+
}, [localX]);
|
|
136
|
+
const dragToPx = useCallback((px) => {
|
|
137
|
+
draggingRef.current = true;
|
|
138
|
+
const clampedPx = Math.min(railRef.current, Math.max(0, px));
|
|
139
|
+
const next = valueForPxRef.current(clampedPx);
|
|
140
|
+
const targetPx = span > 0 ? ((next - min) / span) * railRef.current : clampedPx;
|
|
141
|
+
railProgress.value = railRef.current > 0 ? withSpring(targetPx / railRef.current, PRESS_SPRING) : 0;
|
|
142
|
+
knobRef.current.drag(targetPx, Date.now());
|
|
143
|
+
commitRef.current(next, true);
|
|
144
|
+
}, [min, railProgress, span]);
|
|
145
|
+
const releaseToPx = useCallback((px) => {
|
|
146
|
+
draggingRef.current = false;
|
|
147
|
+
const clampedPx = Math.min(railRef.current, Math.max(0, px));
|
|
148
|
+
const next = valueForPxRef.current(clampedPx);
|
|
149
|
+
const targetPx = span > 0 ? ((next - min) / span) * railRef.current : clampedPx;
|
|
150
|
+
railProgress.value = railRef.current > 0 ? withSpring(targetPx / railRef.current, PRESS_SPRING) : 0;
|
|
151
|
+
knobRef.current.release(targetPx, railRef.current);
|
|
152
|
+
commitRef.current(next, true);
|
|
153
|
+
onSlidingCompleteRef.current?.(next);
|
|
154
|
+
}, [min, railProgress, span]);
|
|
155
|
+
const cancelPointer = useCallback((px, dragged) => {
|
|
156
|
+
draggingRef.current = false;
|
|
157
|
+
if (dragged) {
|
|
158
|
+
const clampedPx = Math.min(railRef.current, Math.max(0, px));
|
|
159
|
+
const next = valueForPxRef.current(clampedPx);
|
|
160
|
+
const targetPx = span > 0 ? ((next - min) / span) * railRef.current : clampedPx;
|
|
161
|
+
railProgress.value = railRef.current > 0 ? withSpring(targetPx / railRef.current, PRESS_SPRING) : 0;
|
|
162
|
+
knobRef.current.release(targetPx, railRef.current);
|
|
163
|
+
commitRef.current(next, true);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const progress = span > 0 ? (current - min) / span : 0;
|
|
167
|
+
railProgress.value = withSpring(progress, PRESS_SPRING);
|
|
168
|
+
knobRef.current.release(progress * railRef.current, railRef.current);
|
|
169
|
+
}, [current, min, railProgress, span]);
|
|
170
|
+
const gesture = useMemo(() => {
|
|
171
|
+
const pan = Gesture.Pan()
|
|
172
|
+
.enabled(!disabled)
|
|
173
|
+
// Claim only clear horizontal movement. This keeps a slider inside a
|
|
174
|
+
// vertical PageScrollView draggable without stealing page scrolling.
|
|
175
|
+
.activeOffsetX([-3, 3])
|
|
176
|
+
.failOffsetY([-14, 14])
|
|
177
|
+
.shouldCancelWhenOutside(false)
|
|
178
|
+
.onBegin((event) => {
|
|
179
|
+
gestureFinished.value = false;
|
|
180
|
+
panActivated.value = false;
|
|
181
|
+
didDrag.value = false;
|
|
182
|
+
const width = Math.max(railWidthShared.value, 1);
|
|
183
|
+
const pointerLocal = pointerXInView(event.absoluteX, railLeft.value, width);
|
|
184
|
+
const knobCenter = railProgress.value * width;
|
|
185
|
+
const nearKnob = Math.abs(pointerLocal - knobCenter) <= KNOB_WIDTH * 0.7;
|
|
186
|
+
grabbedKnob.value = nearKnob;
|
|
187
|
+
grabOffsetPx.value = nearKnob ? pointerLocal - knobCenter : 0;
|
|
188
|
+
lastDragPx.value = nearKnob ? knobCenter : pointerLocal;
|
|
189
|
+
pressProgress.value = withSpring(1, PRESS_SPRING);
|
|
190
|
+
runOnJS(emitPointer)(event.absoluteX);
|
|
191
|
+
})
|
|
192
|
+
.onStart(() => {
|
|
193
|
+
panActivated.value = true;
|
|
194
|
+
})
|
|
195
|
+
.onUpdate((event) => {
|
|
196
|
+
didDrag.value = true;
|
|
197
|
+
const width = Math.max(railWidthShared.value, 1);
|
|
198
|
+
const pointerLocal = pointerXInView(event.absoluteX, railLeft.value, width);
|
|
199
|
+
const px = Math.min(width, Math.max(0, pointerLocal - grabOffsetPx.value));
|
|
200
|
+
lastDragPx.value = px;
|
|
201
|
+
runOnJS(dragToPx)(px);
|
|
202
|
+
})
|
|
203
|
+
.onEnd((event) => {
|
|
204
|
+
gestureFinished.value = true;
|
|
205
|
+
const width = Math.max(railWidthShared.value, 1);
|
|
206
|
+
const pointerLocal = pointerXInView(event.absoluteX, railLeft.value, width);
|
|
207
|
+
const px = Math.min(width, Math.max(0, pointerLocal - grabOffsetPx.value));
|
|
208
|
+
lastDragPx.value = px;
|
|
209
|
+
runOnJS(releaseToPx)(px);
|
|
210
|
+
})
|
|
211
|
+
.onFinalize(() => {
|
|
212
|
+
if (!gestureFinished.value) {
|
|
213
|
+
gestureFinished.value = true;
|
|
214
|
+
runOnJS(cancelPointer)(lastDragPx.value, didDrag.value);
|
|
215
|
+
}
|
|
216
|
+
pressProgress.value = withDelay(PRESS_RELEASE_DELAY_MS, withSpring(0, PRESS_SPRING));
|
|
217
|
+
});
|
|
218
|
+
const tap = Gesture.Tap()
|
|
219
|
+
.enabled(!disabled)
|
|
220
|
+
.maxDistance(10)
|
|
221
|
+
// Match pointer-up semantics from the reference for long stationary
|
|
222
|
+
// holds; the slider tap still commits only after the finger lifts.
|
|
223
|
+
.maxDuration(60000)
|
|
224
|
+
.onEnd((event) => {
|
|
225
|
+
gestureFinished.value = true;
|
|
226
|
+
const width = Math.max(railWidthShared.value, 1);
|
|
227
|
+
const px = pointerXInView(event.absoluteX, railLeft.value, width);
|
|
228
|
+
lastDragPx.value = px;
|
|
229
|
+
runOnJS(releaseToPx)(px);
|
|
230
|
+
})
|
|
231
|
+
.onFinalize(() => {
|
|
232
|
+
if (!panActivated.value) {
|
|
233
|
+
pressProgress.value = withDelay(PRESS_RELEASE_DELAY_MS, withSpring(0, PRESS_SPRING));
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
return Gesture.Race(pan, tap);
|
|
237
|
+
}, [cancelPointer, disabled, didDrag, dragToPx, emitPointer, gestureFinished, grabOffsetPx, grabbedKnob, lastDragPx, panActivated, pressProgress, railLeft, railProgress, railWidthShared, releaseToPx]);
|
|
238
|
+
// A controlled change (or a step change from the parent) re-aims the spring. The
|
|
239
|
+
// knob is the only trigger so a parent re-render mid-drag cannot restart it.
|
|
240
|
+
// Re-aim the spring whenever either the value or the geometry changes. The track
|
|
241
|
+
// length is 0 until layout runs, so keying only on the value would emit a target of
|
|
242
|
+
// 0 and never correct it: measured on device, the knob stayed at the rail's start
|
|
243
|
+
// while the fill and the label both read 35%.
|
|
244
|
+
const setKnobValue = knob.setValue;
|
|
245
|
+
React.useEffect(() => {
|
|
246
|
+
if (draggingRef.current)
|
|
247
|
+
return;
|
|
248
|
+
if (travel <= 0)
|
|
249
|
+
return;
|
|
250
|
+
if (pendingGestureValue.current != null && Math.abs(pendingGestureValue.current - current) < 1e-6) {
|
|
251
|
+
pendingGestureValue.current = null;
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
pendingGestureValue.current = null;
|
|
255
|
+
const progressValue = span > 0 ? (current - min) / span : 0;
|
|
256
|
+
railProgress.value = withSpring(progressValue, PRESS_SPRING);
|
|
257
|
+
// The first emission after layout must not animate from nowhere: the knob is
|
|
258
|
+
// already at its value and should appear there, not slide in from the start.
|
|
259
|
+
setKnobValue(progressValue, travel);
|
|
260
|
+
}, [current, min, railProgress, span, travel, setKnobValue]);
|
|
261
|
+
const adjustByAccessibility = useCallback((direction) => {
|
|
262
|
+
const increment = step > 0 ? step : Math.max(span / 100, 0.01);
|
|
263
|
+
const next = clamp(current + increment * direction);
|
|
264
|
+
if (Math.abs(next - current) < 1e-6)
|
|
265
|
+
return;
|
|
266
|
+
const progressValue = span > 0 ? (next - min) / span : 0;
|
|
267
|
+
railProgress.value = withSpring(progressValue, PRESS_SPRING);
|
|
268
|
+
setKnobValue(progressValue, travel);
|
|
269
|
+
commit(next, true);
|
|
270
|
+
onSlidingComplete?.(next);
|
|
271
|
+
}, [clamp, commit, current, min, onSlidingComplete, railProgress, setKnobValue, span, step, travel]);
|
|
272
|
+
const fillStyle = useAnimatedStyle(() => ({
|
|
273
|
+
width: Math.max(0, railWidthShared.value * railProgress.value),
|
|
274
|
+
}), [railProgress, railWidthShared]);
|
|
275
|
+
return (_jsx(GestureDetector, { gesture: gesture, children: _jsxs(View, { ref: railViewRef, onLayout: onLayout, collapsable: false, accessibilityRole: "adjustable", accessibilityValue: { min, max, now: current }, accessibilityLabel: accessibilityLabel, accessibilityState: { disabled }, accessibilityActions: [{ name: 'increment' }, { name: 'decrement' }], hitSlop: { top: 12, bottom: 12 }, onAccessibilityAction: (event) => {
|
|
276
|
+
if (disabled)
|
|
277
|
+
return;
|
|
278
|
+
if (event.nativeEvent.actionName === 'increment')
|
|
279
|
+
adjustByAccessibility(1);
|
|
280
|
+
if (event.nativeEvent.actionName === 'decrement')
|
|
281
|
+
adjustByAccessibility(-1);
|
|
282
|
+
}, style: [{ height: KNOB_HEIGHT, alignSelf: 'stretch', justifyContent: 'center', opacity: disabled ? .5 : 1 }, style], children: [_jsx(View, { pointerEvents: "none", style: {
|
|
283
|
+
height: RAIL_HEIGHT,
|
|
284
|
+
borderRadius: RAIL_HEIGHT / 2,
|
|
285
|
+
backgroundColor: railOff,
|
|
286
|
+
} }), _jsx(Animated.View, { pointerEvents: "none", style: [{
|
|
287
|
+
position: 'absolute',
|
|
288
|
+
left: 0,
|
|
289
|
+
top: (KNOB_HEIGHT - RAIL_HEIGHT) / 2,
|
|
290
|
+
height: RAIL_HEIGHT,
|
|
291
|
+
borderRadius: RAIL_HEIGHT / 2,
|
|
292
|
+
backgroundColor: accent,
|
|
293
|
+
}, fillStyle] }), showKeyPoints && span > 0 ? keyPoints.filter(point => Number.isFinite(point) && point >= min && point <= max).map((point, index) => (_jsx(View, { pointerEvents: "none", style: { position: 'absolute',
|
|
294
|
+
left: (point - min) / span * railWidth - 1.5, top: (KNOB_HEIGHT - 3) / 2,
|
|
295
|
+
width: 3, height: 3, borderRadius: 1.5, backgroundColor: theme.colors.onGlassMuted } }, `${point}:${index}`))) : null, _jsx(GlassSurface, { variant: "control", positioning: "inFlow", sampling: "backdrop", interactive: false, pointerEvents: "none", opticalProgress: pressProgress, fallbackAnimatedStyle: fallbackKnobStyle, style: {
|
|
296
|
+
position: 'absolute',
|
|
297
|
+
left: 0,
|
|
298
|
+
top: 0,
|
|
299
|
+
width: KNOB_WIDTH,
|
|
300
|
+
height: KNOB_HEIGHT,
|
|
301
|
+
borderRadius: KNOB_HEIGHT / 2,
|
|
302
|
+
}, materialOverrides: {
|
|
303
|
+
opticsModel: 'referenceParity',
|
|
304
|
+
referenceHighlightStyle: 'ambient',
|
|
305
|
+
referenceInteractionProfile: 'slider',
|
|
306
|
+
referenceToggleTrackColorOff: railOff,
|
|
307
|
+
referenceToggleTrackColorOn: accent,
|
|
308
|
+
referenceToggleTrackWidth: railWidth,
|
|
309
|
+
referenceToggleTrackHeight: RAIL_HEIGHT,
|
|
310
|
+
radius: KNOB_HEIGHT / 2,
|
|
311
|
+
blurRadius: 8,
|
|
312
|
+
refractionHeight: 10,
|
|
313
|
+
refractionAmount: -14,
|
|
314
|
+
saturation: 1,
|
|
315
|
+
chromaticAberration: 1,
|
|
316
|
+
highlightAlpha: 1,
|
|
317
|
+
highlightWidth: 0.5 / 1.5,
|
|
318
|
+
// Pinned build-slider.ts settles at 0.3; 0.15 was too
|
|
319
|
+
// faint against the frosted rest-state pebble.
|
|
320
|
+
innerShadowStrength: 0.3,
|
|
321
|
+
shadowOpacity: 0.14,
|
|
322
|
+
shadowRadius: 10,
|
|
323
|
+
shadowOffsetY: 2,
|
|
324
|
+
surfaceColor: { light: '#FFFFFF', dark: '#FFFFFF' },
|
|
325
|
+
}, valueEvent: knob.valueEvent, valueEventSink: knob.valueEventSink })] }) }));
|
|
326
|
+
});
|
|
327
|
+
GlassSlider.displayName = 'GlassSlider';
|
|
328
|
+
//# sourceMappingURL=GlassSlider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlassSlider.js","sourceRoot":"","sources":["../../../src/components/GlassSlider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,QAAQ,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAgDpD,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,mEAA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G,EAAE,CAAC;wBACN,KAAK,EAAE,UAAU;wBACjB,MAAM,EAAE,WAAW;wBACnB,YAAY,EAAE,WAAW,GAAG,CAAC;qBAChC,EACD,iBAAiB,EAAE;wBACf,WAAW,EAAE,iBAAiB;wBAC9B,uBAAuB,EAAE,SAAS;wBAClC,2BAA2B,EAAE,QAAQ;wBACrC,4BAA4B,EAAE,OAAO;wBACrC,2BAA2B,EAAE,MAAM;wBACnC,yBAAyB,EAAE,SAAS;wBACpC,0BAA0B,EAAE,WAAW;wBACvC,MAAM,EAAE,WAAW,GAAG,CAAC;wBACvB,UAAU,EAAE,CAAC;wBACb,gBAAgB,EAAE,EAAE;wBACpB,gBAAgB,EAAE,CAAC,EAAE;wBACrB,UAAU,EAAE,CAAC;wBACb,mBAAmB,EAAE,CAAC;wBACtB,cAAc,EAAE,CAAC;wBACjB,cAAc,EAAE,GAAG,GAAG,GAAG;wBACzB,sDAAsD;wBACtD,+CAA+C;wBAC/C,mBAAmB,EAAE,GAAG;wBACxB,aAAa,EAAE,IAAI;wBACnB,YAAY,EAAE,EAAE;wBAChB,aAAa,EAAE,CAAC;wBAChB,YAAY,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;qBACtD,EACD,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,cAAc,EAAE,IAAI,CAAC,cAAc,GACrC,IACC,GACO,CACrB,CAAC;AACN,CAAC,CAAC,CAAC;AACH,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
5
|
+
import Animated, { interpolateColor, runOnJS, useAnimatedReaction, useAnimatedStyle, useSharedValue, withDelay, withSpring } from 'react-native-reanimated';
|
|
6
|
+
import { GlassSurface } from '../GlassSurface';
|
|
7
|
+
import { useGlassKnobMotion } from '../useGlassKnobMotion';
|
|
8
|
+
import { useTheme } from '../theme';
|
|
9
|
+
import { useControlPress } from './ControlPressContext';
|
|
10
|
+
const RAIL_WIDTH = 64;
|
|
11
|
+
const RAIL_HEIGHT = 28;
|
|
12
|
+
const THUMB_WIDTH = 40;
|
|
13
|
+
const THUMB_HEIGHT = 24;
|
|
14
|
+
const INSET = (RAIL_HEIGHT - THUMB_HEIGHT) / 2;
|
|
15
|
+
const TRAVEL = RAIL_WIDTH - THUMB_WIDTH - INSET * 2;
|
|
16
|
+
/** Reference `LiquidToggle`: 0xFF34C759 light, 0xFF30D158 dark. */
|
|
17
|
+
const ACCENT_LIGHT = '#34C759';
|
|
18
|
+
const ACCENT_DARK = '#30D158';
|
|
19
|
+
/** Reference rail: 0xFF787878 at 20% light, 0xFF787880 at 36% dark. */
|
|
20
|
+
const RAIL_OFF_LIGHT = 'rgba(120,120,120,0.20)';
|
|
21
|
+
const RAIL_OFF_DARK = 'rgba(120,120,128,0.36)';
|
|
22
|
+
const VALUE_SPRING = { damping: 2 * Math.sqrt(1000), stiffness: 1000, mass: 1 };
|
|
23
|
+
const PRESS_RELEASE_DELAY_MS = 180;
|
|
24
|
+
export const GlassSwitch = memo(function GlassSwitch({ value, defaultValue = false, onValueChange, disabled = false, style, trackColorOff, trackColorOn, accessibilityLabel, interactive = true, referenceBackdropColor, }) {
|
|
25
|
+
const theme = useTheme();
|
|
26
|
+
const isDark = theme.dark;
|
|
27
|
+
const accent = trackColorOn ?? (isDark ? ACCENT_DARK : ACCENT_LIGHT);
|
|
28
|
+
const railOff = trackColorOff ?? (isDark ? RAIL_OFF_DARK : RAIL_OFF_LIGHT);
|
|
29
|
+
const controlled = value !== undefined;
|
|
30
|
+
const [internal, setInternal] = React.useState(defaultValue);
|
|
31
|
+
const checked = controlled ? value : internal;
|
|
32
|
+
const checkedRef = useRef(checked);
|
|
33
|
+
checkedRef.current = checked;
|
|
34
|
+
const row = useControlPress();
|
|
35
|
+
const rowBound = !interactive && row?.onPress != null;
|
|
36
|
+
const handlesGesture = !disabled && (interactive || rowBound);
|
|
37
|
+
const rowPress = row?.pressed;
|
|
38
|
+
const suppressRowPress = row?.suppressPress;
|
|
39
|
+
const ownsTouch = useSharedValue(false);
|
|
40
|
+
const didDrag = useSharedValue(false);
|
|
41
|
+
const startFraction = useSharedValue(checked ? 1 : 0);
|
|
42
|
+
const startTouchX = useSharedValue(0);
|
|
43
|
+
const railProgress = useSharedValue(checked ? 1 : 0);
|
|
44
|
+
const pressProgress = useSharedValue(0);
|
|
45
|
+
const gestureFinished = useSharedValue(false);
|
|
46
|
+
const panActivated = useSharedValue(false);
|
|
47
|
+
const pendingGestureValue = useRef(null);
|
|
48
|
+
const knob = useGlassKnobMotion(checked ? 1 : 0, TRAVEL);
|
|
49
|
+
const releaseKnob = knob.release;
|
|
50
|
+
const setKnobValue = knob.setValue;
|
|
51
|
+
const fallbackThumbStyle = useAnimatedStyle(() => ({
|
|
52
|
+
transform: [{ translateX: knob.fallbackProgress.value * TRAVEL }],
|
|
53
|
+
}), [knob.fallbackProgress]);
|
|
54
|
+
const commit = useCallback((next) => {
|
|
55
|
+
if (rowBound) {
|
|
56
|
+
// Existing consumers let the row toggle a controlled value. A drag
|
|
57
|
+
// back to its original end (or a cancelled gesture) is not a toggle.
|
|
58
|
+
if (next !== checkedRef.current)
|
|
59
|
+
row?.onPress?.();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!controlled)
|
|
63
|
+
setInternal(next);
|
|
64
|
+
onValueChange?.(next);
|
|
65
|
+
}, [controlled, onValueChange, row, rowBound]);
|
|
66
|
+
/**
|
|
67
|
+
* The reference's release rule: nearest end wins, unless the release was a tap,
|
|
68
|
+
* which inverts the current state. A tap never moves the value, so `didDrag` is
|
|
69
|
+
* what distinguishes "let go of a drag" from "tapped the control".
|
|
70
|
+
*/
|
|
71
|
+
const settle = useCallback((travelPx, velocityNormalised, dragged, wasChecked) => {
|
|
72
|
+
const flick = Math.abs(velocityNormalised) > 1.5;
|
|
73
|
+
const next = flick
|
|
74
|
+
? velocityNormalised > 0
|
|
75
|
+
: dragged
|
|
76
|
+
? travelPx / TRAVEL >= 0.5
|
|
77
|
+
: !wasChecked;
|
|
78
|
+
pendingGestureValue.current = next;
|
|
79
|
+
// The native release spring targets the selected endpoint and inherits
|
|
80
|
+
// the sampled finger velocity. Sending the raw release position here
|
|
81
|
+
// left the thumb between endpoints once the controlled-value sync was
|
|
82
|
+
// correctly suppressed below.
|
|
83
|
+
releaseKnob(next ? TRAVEL : 0, TRAVEL);
|
|
84
|
+
commit(next);
|
|
85
|
+
}, [commit, releaseKnob]);
|
|
86
|
+
// runOnJS callbacks are captured as JS functions. Refs are only read inside
|
|
87
|
+
// these JS callbacks; the UI worklet never dereferences a React ref.
|
|
88
|
+
const begin = knob.begin;
|
|
89
|
+
const drag = knob.drag;
|
|
90
|
+
const beginAt = useCallback((fractionAtDown) => {
|
|
91
|
+
const clamped = Math.min(1, Math.max(0, fractionAtDown));
|
|
92
|
+
begin(clamped * TRAVEL, Date.now());
|
|
93
|
+
}, [begin]);
|
|
94
|
+
const dragAt = useCallback((travelPx) => drag(travelPx, Date.now()), [drag]);
|
|
95
|
+
const toggleFromAccessibility = useCallback(() => {
|
|
96
|
+
if (!handlesGesture)
|
|
97
|
+
return;
|
|
98
|
+
const next = !checked;
|
|
99
|
+
pendingGestureValue.current = next;
|
|
100
|
+
railProgress.value = withSpring(next ? 1 : 0, VALUE_SPRING);
|
|
101
|
+
setKnobValue(next ? 1 : 0, TRAVEL);
|
|
102
|
+
commit(next);
|
|
103
|
+
}, [checked, commit, handlesGesture, railProgress, setKnobValue]);
|
|
104
|
+
const cancelGesture = useCallback(() => {
|
|
105
|
+
railProgress.value = withSpring(checked ? 1 : 0, VALUE_SPRING);
|
|
106
|
+
releaseKnob(checked ? TRAVEL : 0, TRAVEL);
|
|
107
|
+
}, [checked, railProgress, releaseKnob]);
|
|
108
|
+
// Touches on the row's label share the lens feedback. Touches on the switch
|
|
109
|
+
// itself own their press/release so cancellation of the parent Pressable
|
|
110
|
+
// cannot reset a horizontal drag halfway through.
|
|
111
|
+
const syncRowPress = useCallback((down) => {
|
|
112
|
+
const travel = checkedRef.current ? TRAVEL : 0;
|
|
113
|
+
if (down)
|
|
114
|
+
begin(travel, Date.now());
|
|
115
|
+
else
|
|
116
|
+
releaseKnob(travel, TRAVEL);
|
|
117
|
+
}, [begin, releaseKnob]);
|
|
118
|
+
useAnimatedReaction(() => !interactive && !disabled && rowPress && !ownsTouch.value ? rowPress.value : null, (down, previous) => {
|
|
119
|
+
if (down === null || down === previous || (previous === null && down === 0))
|
|
120
|
+
return;
|
|
121
|
+
pressProgress.value = down
|
|
122
|
+
? withSpring(1, VALUE_SPRING)
|
|
123
|
+
: withDelay(PRESS_RELEASE_DELAY_MS, withSpring(0, VALUE_SPRING));
|
|
124
|
+
runOnJS(syncRowPress)(down !== 0);
|
|
125
|
+
}, [disabled, interactive, ownsTouch, rowPress, syncRowPress]);
|
|
126
|
+
const gesture = useMemo(() => {
|
|
127
|
+
const pan = Gesture.Pan()
|
|
128
|
+
.enabled(handlesGesture)
|
|
129
|
+
// Claim clear horizontal drags while letting the surrounding vertical
|
|
130
|
+
// PageScrollView keep ownership of vertical movement. Tap's onBegin
|
|
131
|
+
// still starts the press spring immediately on touch-down.
|
|
132
|
+
.activeOffsetX([-3, 3])
|
|
133
|
+
.failOffsetY([-14, 14])
|
|
134
|
+
.shouldCancelWhenOutside(false)
|
|
135
|
+
.onBegin((event) => {
|
|
136
|
+
ownsTouch.value = true;
|
|
137
|
+
if (suppressRowPress)
|
|
138
|
+
suppressRowPress.value = true;
|
|
139
|
+
didDrag.value = false;
|
|
140
|
+
gestureFinished.value = false;
|
|
141
|
+
panActivated.value = false;
|
|
142
|
+
startFraction.value = railProgress.value;
|
|
143
|
+
startTouchX.value = event.absoluteX;
|
|
144
|
+
pressProgress.value = withSpring(1, VALUE_SPRING);
|
|
145
|
+
runOnJS(beginAt)(startFraction.value);
|
|
146
|
+
})
|
|
147
|
+
.onStart(() => {
|
|
148
|
+
panActivated.value = true;
|
|
149
|
+
if (suppressRowPress)
|
|
150
|
+
suppressRowPress.value = true;
|
|
151
|
+
})
|
|
152
|
+
.onUpdate((event) => {
|
|
153
|
+
if (Math.abs(event.translationX) >= 2)
|
|
154
|
+
didDrag.value = true;
|
|
155
|
+
// Relative drag from the thumb's resting/current fraction prevents
|
|
156
|
+
// jumping to the finger's X when starting a slide after long-press.
|
|
157
|
+
const nextFraction = Math.min(1, Math.max(0, startFraction.value + (event.absoluteX - startTouchX.value) / TRAVEL));
|
|
158
|
+
railProgress.value = nextFraction;
|
|
159
|
+
runOnJS(dragAt)(nextFraction * TRAVEL);
|
|
160
|
+
})
|
|
161
|
+
.onEnd((event, success) => {
|
|
162
|
+
if (!success)
|
|
163
|
+
return;
|
|
164
|
+
gestureFinished.value = true;
|
|
165
|
+
const nextFraction = Math.min(1, Math.max(0, startFraction.value + (event.absoluteX - startTouchX.value) / TRAVEL));
|
|
166
|
+
const travel = nextFraction * TRAVEL;
|
|
167
|
+
const normalised = TRAVEL > 0 ? event.velocityX / TRAVEL : 0;
|
|
168
|
+
const dragged = didDrag.value;
|
|
169
|
+
const flick = Math.abs(normalised) > 1.5;
|
|
170
|
+
const next = flick
|
|
171
|
+
? normalised > 0
|
|
172
|
+
: dragged
|
|
173
|
+
? nextFraction >= 0.5
|
|
174
|
+
: !checked;
|
|
175
|
+
railProgress.value = withSpring(next ? 1 : 0, VALUE_SPRING);
|
|
176
|
+
runOnJS(settle)(travel, normalised, dragged, checked);
|
|
177
|
+
didDrag.value = false;
|
|
178
|
+
})
|
|
179
|
+
.onFinalize(() => {
|
|
180
|
+
// Failed vertical drags also belong to this touch sequence.
|
|
181
|
+
// RN Pressable can retain its expanded press rectangle when a
|
|
182
|
+
// short settings page cannot scroll; it must not toggle on UP.
|
|
183
|
+
if (suppressRowPress)
|
|
184
|
+
suppressRowPress.value = true;
|
|
185
|
+
if (!gestureFinished.value) {
|
|
186
|
+
gestureFinished.value = true;
|
|
187
|
+
runOnJS(cancelGesture)();
|
|
188
|
+
}
|
|
189
|
+
pressProgress.value = withDelay(PRESS_RELEASE_DELAY_MS, withSpring(0, VALUE_SPRING));
|
|
190
|
+
ownsTouch.value = false;
|
|
191
|
+
});
|
|
192
|
+
const tap = Gesture.Tap()
|
|
193
|
+
.enabled(handlesGesture)
|
|
194
|
+
.maxDistance(8)
|
|
195
|
+
// The web reference ends its press on pointer-up regardless of hold
|
|
196
|
+
// time. Keep a stationary touch from timing out and leaving the
|
|
197
|
+
// native knob's press spring without a matching release.
|
|
198
|
+
.maxDuration(60000)
|
|
199
|
+
.onStart(() => {
|
|
200
|
+
if (suppressRowPress)
|
|
201
|
+
suppressRowPress.value = true;
|
|
202
|
+
})
|
|
203
|
+
.onEnd((_event, success) => {
|
|
204
|
+
if (!success)
|
|
205
|
+
return;
|
|
206
|
+
gestureFinished.value = true;
|
|
207
|
+
const at = checked ? TRAVEL : 0;
|
|
208
|
+
railProgress.value = withSpring(checked ? 0 : 1, VALUE_SPRING);
|
|
209
|
+
runOnJS(settle)(at, 0, false, checked);
|
|
210
|
+
})
|
|
211
|
+
.onFinalize(() => {
|
|
212
|
+
if (!panActivated.value) {
|
|
213
|
+
pressProgress.value = withDelay(PRESS_RELEASE_DELAY_MS, withSpring(0, VALUE_SPRING));
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
return Gesture.Race(pan, tap);
|
|
217
|
+
}, [beginAt, cancelGesture, checked, didDrag, handlesGesture, dragAt, gestureFinished, ownsTouch, panActivated, pressProgress, railProgress, settle, startFraction, startTouchX, suppressRowPress]);
|
|
218
|
+
const railStyle = useAnimatedStyle(() => ({
|
|
219
|
+
backgroundColor: interpolateColor(railProgress.value, [0, 1], [railOff, accent]),
|
|
220
|
+
}), [accent, railOff, railProgress]);
|
|
221
|
+
// A controlled change from the parent moves the thumb through the same spring, so
|
|
222
|
+
// a programmatic toggle glides instead of jumping while a gesture would not.
|
|
223
|
+
// Depending on `knob` would re-emit on every render and restart the spring under
|
|
224
|
+
// the finger, so the value is the only trigger.
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
if (pendingGestureValue.current === checked) {
|
|
227
|
+
pendingGestureValue.current = null;
|
|
228
|
+
// A gesture updates the rail on the UI thread while it owns the
|
|
229
|
+
// finger. Re-sync the settled rail from the controlled value as
|
|
230
|
+
// well: otherwise a tap can move the glass thumb to `checked` while
|
|
231
|
+
// the backdrop rail keeps the previous color on some Fabric/RNGH
|
|
232
|
+
// release paths. The knob already received its release event, so
|
|
233
|
+
// leave that native spring alone here.
|
|
234
|
+
railProgress.value = withSpring(checked ? 1 : 0, VALUE_SPRING);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
pendingGestureValue.current = null;
|
|
238
|
+
railProgress.value = withSpring(checked ? 1 : 0, VALUE_SPRING);
|
|
239
|
+
setKnobValue(checked ? 1 : 0, TRAVEL);
|
|
240
|
+
}, [checked, railProgress, setKnobValue]);
|
|
241
|
+
return (_jsx(GestureDetector, { gesture: gesture, children: _jsxs(View
|
|
242
|
+
// RNGH needs a real native view to attach its handler to. Without
|
|
243
|
+
// this the View is collapsed away on Android and the gesture has
|
|
244
|
+
// nothing to bind to, so taps never reach it.
|
|
245
|
+
, {
|
|
246
|
+
// RNGH needs a real native view to attach its handler to. Without
|
|
247
|
+
// this the View is collapsed away on Android and the gesture has
|
|
248
|
+
// nothing to bind to, so taps never reach it.
|
|
249
|
+
collapsable: false, pointerEvents: handlesGesture ? 'auto' : 'none', accessibilityRole: "switch", accessibilityState: { checked, disabled }, accessibilityLabel: accessibilityLabel, accessibilityActions: [{ name: 'activate', label: 'Toggle' }], onAccessibilityAction: (event) => {
|
|
250
|
+
if (event.nativeEvent.actionName === 'activate')
|
|
251
|
+
toggleFromAccessibility();
|
|
252
|
+
}, style: [{ width: RAIL_WIDTH, height: RAIL_HEIGHT, opacity: disabled ? .5 : 1 }, style], children: [_jsx(Animated.View, { pointerEvents: "none", style: [{
|
|
253
|
+
position: 'absolute',
|
|
254
|
+
left: 0,
|
|
255
|
+
top: 0,
|
|
256
|
+
width: RAIL_WIDTH,
|
|
257
|
+
height: RAIL_HEIGHT,
|
|
258
|
+
borderRadius: RAIL_HEIGHT / 2,
|
|
259
|
+
}, railStyle] }), _jsx(GlassSurface, { variant: "control", positioning: "inFlow", sampling: "backdrop",
|
|
260
|
+
// Keep the lens in the same native scroll tree as its rail.
|
|
261
|
+
// The shader composites the magnified rail over the real
|
|
262
|
+
// backdrop; the thumb never needs to sample its own row.
|
|
263
|
+
samplingSource: "themeBackdrop", inlineBackdrop: true, interactive: false, pointerEvents: "none", opticalProgress: pressProgress, fallbackAnimatedStyle: fallbackThumbStyle, style: {
|
|
264
|
+
position: 'absolute',
|
|
265
|
+
left: INSET,
|
|
266
|
+
top: INSET,
|
|
267
|
+
width: THUMB_WIDTH,
|
|
268
|
+
height: THUMB_HEIGHT,
|
|
269
|
+
borderRadius: THUMB_HEIGHT / 2,
|
|
270
|
+
}, materialOverrides: {
|
|
271
|
+
opticsModel: 'referenceParity',
|
|
272
|
+
referenceHighlightStyle: 'ambient',
|
|
273
|
+
referenceInteractionProfile: 'toggle',
|
|
274
|
+
referenceToggleTrackColorOff: railOff,
|
|
275
|
+
referenceToggleTrackColorOn: accent,
|
|
276
|
+
referenceToggleTrackWidth: RAIL_WIDTH,
|
|
277
|
+
referenceToggleTrackHeight: RAIL_HEIGHT,
|
|
278
|
+
referenceToggleSolidBackdropColor: referenceBackdropColor,
|
|
279
|
+
radius: THUMB_HEIGHT / 2,
|
|
280
|
+
blurRadius: 8,
|
|
281
|
+
refractionHeight: 5,
|
|
282
|
+
refractionAmount: -10,
|
|
283
|
+
saturation: 1,
|
|
284
|
+
chromaticAberration: 1,
|
|
285
|
+
highlightAlpha: 1,
|
|
286
|
+
highlightWidth: 0.5 / 1.5,
|
|
287
|
+
// The upstream toggle calibration raised this from the
|
|
288
|
+
// Android source default so the pressed glass rim stays
|
|
289
|
+
// visible against both the rail and the wallpaper.
|
|
290
|
+
innerShadowStrength: 0.3,
|
|
291
|
+
shadowOpacity: 0.05,
|
|
292
|
+
shadowRadius: 4,
|
|
293
|
+
shadowOffsetY: 4 / 6,
|
|
294
|
+
surfaceColor: { light: '#FFFFFF', dark: '#FFFFFF' },
|
|
295
|
+
}, valueEvent: knob.valueEvent, valueEventSink: knob.valueEventSink })] }) }));
|
|
296
|
+
});
|
|
297
|
+
GlassSwitch.displayName = 'GlassSwitch';
|
|
298
|
+
//# sourceMappingURL=GlassSwitch.js.map
|