@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,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListRow = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const primitives_1 = require("../primitives");
|
|
6
|
+
const theme_1 = require("../theme");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
const react_native_reanimated_1 = require("react-native-reanimated");
|
|
10
|
+
const ControlPressContext_1 = require("./ControlPressContext");
|
|
11
|
+
exports.ListRow = (0, react_1.memo)(function ListRow(props) {
|
|
12
|
+
return (props.onPress || props.onPressIn) && !props.disabled
|
|
13
|
+
? (0, jsx_runtime_1.jsx)(InteractiveListRow, { ...props })
|
|
14
|
+
: (0, jsx_runtime_1.jsx)(StaticListRow, { ...props });
|
|
15
|
+
});
|
|
16
|
+
exports.ListRow.displayName = 'HyperListRow';
|
|
17
|
+
function ListRowContent({ props }) {
|
|
18
|
+
const theme = (0, theme_1.useTheme)();
|
|
19
|
+
const c = theme.components.preference;
|
|
20
|
+
const titleColor = props.disabled
|
|
21
|
+
? theme.colors.disabledOnSecondaryVariant
|
|
22
|
+
: props.titleColor ?? theme.colors.onBackground;
|
|
23
|
+
const summaryColor = props.disabled
|
|
24
|
+
? theme.colors.disabledOnSecondaryVariant
|
|
25
|
+
: props.summaryColor ?? theme.colors.onSurfaceVariantSummary;
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { flexDirection: 'row', alignItems: 'center', gap: c.gap }, children: [props.icon != null && (0, jsx_runtime_1.jsx)(react_native_1.View, { style: { flex: 0, alignItems: 'center', justifyContent: 'center' }, children: props.icon }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { flex: 1, minWidth: 0, flexDirection: 'column', alignItems: 'flex-start', justifyContent: 'center' }, children: [props.title != null && ((0, jsx_runtime_1.jsx)(primitives_1.Text, { type: "headline1", weight: "medium", color: titleColor, numberOfLines: 1, children: props.title })), props.summary != null && ((0, jsx_runtime_1.jsx)(primitives_1.Text, { type: "body2", color: summaryColor, numberOfLines: props.summaryNumberOfLines ?? 1, children: props.summary }))] }), props.trailing != null && ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: { flex: 0, alignItems: 'center', justifyContent: 'center', marginLeft: 'auto' }, children: props.trailing }))] }));
|
|
27
|
+
}
|
|
28
|
+
function StaticListRow(props) {
|
|
29
|
+
const theme = (0, theme_1.useTheme)();
|
|
30
|
+
const c = theme.components.preference;
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityState: { disabled: !!props.disabled }, style: [{ minHeight: c.minHeight, padding: c.padding, justifyContent: 'center' }, props.style], children: (0, jsx_runtime_1.jsx)(ListRowContent, { props: props }) }));
|
|
32
|
+
}
|
|
33
|
+
function InteractiveListRow(props) {
|
|
34
|
+
const theme = (0, theme_1.useTheme)();
|
|
35
|
+
const c = theme.components.preference;
|
|
36
|
+
const pressed = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
37
|
+
const suppressPress = (0, react_native_reanimated_1.useSharedValue)(false);
|
|
38
|
+
const controlCommitted = (0, react_1.useRef)(false);
|
|
39
|
+
const onControlPress = (0, react_1.useCallback)(() => {
|
|
40
|
+
if (controlCommitted.current)
|
|
41
|
+
return;
|
|
42
|
+
controlCommitted.current = true;
|
|
43
|
+
suppressPress.value = true;
|
|
44
|
+
props.onPress?.();
|
|
45
|
+
}, [props.onPress, suppressPress]);
|
|
46
|
+
const controlOwner = (0, react_1.useMemo)(() => ({ pressed, suppressPress,
|
|
47
|
+
onPress: props.onPress ? onControlPress : undefined }), [pressed, suppressPress, props.onPress, onControlPress]);
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { accessibilityRole: "button", accessibilityState: { disabled: false }, onTouchStart: () => {
|
|
49
|
+
controlCommitted.current = false;
|
|
50
|
+
suppressPress.value = false;
|
|
51
|
+
}, onPress: () => {
|
|
52
|
+
// A control can commit before Pressability delivers its delayed
|
|
53
|
+
// press-in/release callbacks. Keep a JS guard as well as the UI
|
|
54
|
+
// gesture flag, including when that commit changes MotionProvider.
|
|
55
|
+
if (!controlCommitted.current && !suppressPress.value)
|
|
56
|
+
props.onPress?.();
|
|
57
|
+
}, onPressIn: () => {
|
|
58
|
+
pressed.value = 1;
|
|
59
|
+
props.onPressIn?.();
|
|
60
|
+
}, onPressOut: () => {
|
|
61
|
+
pressed.value = 0;
|
|
62
|
+
}, style: [{ minHeight: c.minHeight, padding: c.padding, justifyContent: 'center' }, props.style], children: (0, jsx_runtime_1.jsxs)(ControlPressContext_1.ControlPressContext.Provider, { value: controlOwner, children: [(0, jsx_runtime_1.jsx)(ListRowContent, { props: props }), (0, jsx_runtime_1.jsx)(primitives_1.PressIndication, { pressed: pressed, color: theme.colors.onBackground })] }) }));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=ListRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListRow.js","sourceRoot":"","sources":["../../../src/components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K,GAAG,KAAK,CAAC;QAChC,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;YACV,gEAAgE;YAChE,gEAAgE;YAChE,mEAAmE;YACnE,IAAI,CAAC,gBAAgB,CAAC,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK;gBAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QAC7E,CAAC,EACD,SAAS,EAAE,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;YAClB,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC;QACxB,CAAC,EACD,UAAU,EAAE,GAAG,EAAE;YACb,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;QACtB,CAAC,EACD,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,YAE9F,wBAAC,yCAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,aAC7C,uBAAC,cAAc,IAAC,KAAK,EAAE,KAAK,GAAI,EAChC,uBAAC,4BAAe,IAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,YAAY,GAAI,IAC5C,GACvB,CACf,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,214 @@
|
|
|
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.Menu = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const primitives_1 = require("../primitives");
|
|
39
|
+
const GlassSurface_1 = require("../GlassSurface");
|
|
40
|
+
const motion_1 = require("../motion");
|
|
41
|
+
const menuPosition_1 = require("./menuPosition");
|
|
42
|
+
const theme_1 = require("../theme");
|
|
43
|
+
const useGlassPressMotion_1 = require("../useGlassPressMotion");
|
|
44
|
+
const MotionProvider_1 = require("../motion/MotionProvider");
|
|
45
|
+
const glassControlMaterial_1 = require("./glassControlMaterial");
|
|
46
|
+
const react_1 = __importStar(require("react"));
|
|
47
|
+
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
48
|
+
const react_native_1 = require("react-native");
|
|
49
|
+
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
50
|
+
const MARGIN = 8;
|
|
51
|
+
const SCALE_HIDDEN = 0.15;
|
|
52
|
+
// miuix ListPopup item paddings — reference values (not on the spacing scale).
|
|
53
|
+
const ITEM_PADDING_HORIZONTAL = 20;
|
|
54
|
+
const ITEM_PADDING_VERTICAL_EDGE = 20; // first / last item
|
|
55
|
+
const ITEM_PADDING_VERTICAL_MIDDLE = 12; // middle items
|
|
56
|
+
exports.Menu = react_1.default.memo(function Menu({ visible = false, onClose, anchor, items = [], selectedIndex }) {
|
|
57
|
+
const theme = (0, theme_1.useTheme)();
|
|
58
|
+
const usesGlassMaterial = theme.glass.enabled;
|
|
59
|
+
const reducedMotion = (0, MotionProvider_1.useReducedMotionPreference)();
|
|
60
|
+
const { width: windowW, height: windowH } = (0, react_native_1.useWindowDimensions)();
|
|
61
|
+
const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
62
|
+
const [rendered, setRendered] = (0, react_1.useState)(visible);
|
|
63
|
+
const visibleRef = (0, react_1.useRef)(visible);
|
|
64
|
+
visibleRef.current = visible;
|
|
65
|
+
const finishClose = (0, react_1.useCallback)(() => { if (!visibleRef.current)
|
|
66
|
+
setRendered(false); }, []);
|
|
67
|
+
const [popupHeight, setPopupHeight] = (0, react_1.useState)(0);
|
|
68
|
+
const [placement, setPlacement] = (0, react_1.useState)('below');
|
|
69
|
+
const popupWidth = Math.min(240, windowW - MARGIN * 2);
|
|
70
|
+
const fraction = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
71
|
+
const alpha = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
72
|
+
const dim = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
73
|
+
const onContentSizeChange = (0, react_1.useCallback)((_width, height) => {
|
|
74
|
+
setPopupHeight(height);
|
|
75
|
+
}, []);
|
|
76
|
+
// Positioning (miuix dropdownPositionProvider): End-aligned → popup right
|
|
77
|
+
// edge = anchor right edge, coerced on-screen.
|
|
78
|
+
const positionAnchor = anchor != null && usesGlassMaterial && react_native_1.Platform.OS === 'android'
|
|
79
|
+
? (0, menuPosition_1.menuAnchorWithTopInset)(anchor, insets.top)
|
|
80
|
+
: anchor;
|
|
81
|
+
const pos = positionAnchor != null
|
|
82
|
+
? (0, menuPosition_1.computeMenuPosition)({ anchor: positionAnchor, placement, popupHeight, popupWidth, windowW, windowH })
|
|
83
|
+
: { top: 0, left: 0, maxHeight: 0 };
|
|
84
|
+
(0, react_1.useEffect)(() => {
|
|
85
|
+
if (visible) {
|
|
86
|
+
setRendered(true);
|
|
87
|
+
fraction.value = reducedMotion ? 1 : (0, react_native_reanimated_1.withSpring)(1, motion_1.menuFraction);
|
|
88
|
+
alpha.value = (0, react_native_reanimated_1.withTiming)(1, reducedMotion ? { duration: 100 } : motion_1.menuAlphaIn);
|
|
89
|
+
dim.value = (0, react_native_reanimated_1.withTiming)(1, motion_1.menuDimIn);
|
|
90
|
+
}
|
|
91
|
+
else if (rendered) {
|
|
92
|
+
fraction.value = reducedMotion ? 1 : (0, react_native_reanimated_1.withSpring)(0, motion_1.menuFraction);
|
|
93
|
+
dim.value = (0, react_native_reanimated_1.withTiming)(0, motion_1.menuDimOut);
|
|
94
|
+
alpha.value = (0, react_native_reanimated_1.withTiming)(0, reducedMotion ? { duration: 100 } : motion_1.menuAlphaOut, (finished) => {
|
|
95
|
+
if (finished)
|
|
96
|
+
(0, react_native_reanimated_1.runOnJS)(finishClose)();
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}, [visible, rendered, fraction, alpha, dim, reducedMotion, finishClose]);
|
|
100
|
+
// Decide below / above / middle once the popup has been measured.
|
|
101
|
+
(0, react_1.useEffect)(() => {
|
|
102
|
+
if (!rendered || !anchor)
|
|
103
|
+
return;
|
|
104
|
+
const adjusted = usesGlassMaterial && react_native_1.Platform.OS === 'android'
|
|
105
|
+
? (0, menuPosition_1.menuAnchorWithTopInset)(anchor, insets.top) : anchor;
|
|
106
|
+
setPlacement((0, menuPosition_1.resolveMenuPlacement)(adjusted, popupHeight, windowH));
|
|
107
|
+
}, [rendered, anchor, popupHeight, windowH, usesGlassMaterial, insets.top]);
|
|
108
|
+
const dimStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
109
|
+
opacity: dim.value,
|
|
110
|
+
backgroundColor: theme.colors.windowDimming,
|
|
111
|
+
}));
|
|
112
|
+
const origin = placement === 'below' ? 'top right' : placement === 'above' ? 'bottom right' : 'right center';
|
|
113
|
+
const popupStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
114
|
+
transform: [{ scale: SCALE_HIDDEN + 0.85 * fraction.value }],
|
|
115
|
+
opacity: alpha.value,
|
|
116
|
+
transformOrigin: origin,
|
|
117
|
+
}), [origin]);
|
|
118
|
+
const handleClose = (0, react_1.useCallback)(() => {
|
|
119
|
+
onClose?.();
|
|
120
|
+
}, [onClose]);
|
|
121
|
+
(0, react_1.useEffect)(() => {
|
|
122
|
+
if (!usesGlassMaterial || !rendered)
|
|
123
|
+
return;
|
|
124
|
+
const subscription = react_native_1.BackHandler.addEventListener('hardwareBackPress', () => {
|
|
125
|
+
handleClose();
|
|
126
|
+
return true;
|
|
127
|
+
});
|
|
128
|
+
return () => subscription.remove();
|
|
129
|
+
}, [usesGlassMaterial, rendered, handleClose]);
|
|
130
|
+
const popupItems = items.map((item, index) => {
|
|
131
|
+
const it = typeof item === 'string' ? { label: item } : item;
|
|
132
|
+
return ((0, jsx_runtime_1.jsx)(MenuItemRow, { item: it, first: index === 0, last: index === items.length - 1, selected: index === selectedIndex, onSelect: () => {
|
|
133
|
+
if (it.disabled)
|
|
134
|
+
return;
|
|
135
|
+
it.onPress?.();
|
|
136
|
+
handleClose();
|
|
137
|
+
} }, index));
|
|
138
|
+
});
|
|
139
|
+
// A viewport constrained by space below the trigger reports only its
|
|
140
|
+
// clipped height. Measure scroll CONTENT instead, so near-bottom menus
|
|
141
|
+
// can move above the trigger and oversized menus keep every item reachable.
|
|
142
|
+
const popupContent = ((0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { style: { flexGrow: 0, flexShrink: 1 }, onContentSizeChange: onContentSizeChange, keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: false, children: popupItems }));
|
|
143
|
+
const menuLayer = ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "none", style: [react_native_1.StyleSheet.absoluteFill, dimStyle] }), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { style: react_native_1.StyleSheet.absoluteFill, onPress: handleClose }), anchor != null && ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [
|
|
144
|
+
{
|
|
145
|
+
position: 'absolute',
|
|
146
|
+
top: pos.top,
|
|
147
|
+
left: pos.left,
|
|
148
|
+
width: popupWidth,
|
|
149
|
+
maxHeight: pos.maxHeight,
|
|
150
|
+
borderRadius: theme.radius.component,
|
|
151
|
+
backgroundColor: usesGlassMaterial ? 'transparent' : theme.colors.surfaceContainer,
|
|
152
|
+
overflow: 'hidden',
|
|
153
|
+
shadowColor: '#000000',
|
|
154
|
+
shadowOpacity: usesGlassMaterial ? 0 : 0.18,
|
|
155
|
+
shadowRadius: usesGlassMaterial ? 0 : 40,
|
|
156
|
+
shadowOffset: { width: 0, height: usesGlassMaterial ? 0 : 10 },
|
|
157
|
+
elevation: usesGlassMaterial ? 0 : 8,
|
|
158
|
+
},
|
|
159
|
+
popupStyle,
|
|
160
|
+
], children: usesGlassMaterial ? ((0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "menu", positioning: "floating", sampling: "backdrop", inlineBackdrop: true, intrinsicInlineBackdrop: true, zIndex: 101, style: { width: '100%', maxHeight: pos.maxHeight, borderRadius: theme.glass.materials.menu.radius, overflow: 'hidden' },
|
|
161
|
+
// The popup is content-sized. GlassSurface's default
|
|
162
|
+
// backdrop measurement wrapper uses flex: 1, which has
|
|
163
|
+
// no height to fill here and collapses the menu rows
|
|
164
|
+
// to zero on Android. Restore intrinsic row sizing;
|
|
165
|
+
// the parent maxHeight still limits the popup to the
|
|
166
|
+
// available window space.
|
|
167
|
+
contentStyle: { flex: 0, flexShrink: 1 }, children: popupContent })) : popupContent }))] }));
|
|
168
|
+
// Menus are transient overlays and must sit above page chrome (back/theme
|
|
169
|
+
// buttons) as well as the page body. The surface itself is registered at
|
|
170
|
+
// zIndex 101, but GlassOverlay controls the React content layer that owns
|
|
171
|
+
// the scrim and item hit targets.
|
|
172
|
+
if (usesGlassMaterial)
|
|
173
|
+
return rendered ? (0, jsx_runtime_1.jsx)(GlassSurface_1.GlassOverlay, { zIndex: 200, children: menuLayer }) : null;
|
|
174
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { transparent: true, statusBarTranslucent: true, animationType: "none", visible: rendered, onRequestClose: handleClose, children: menuLayer }));
|
|
175
|
+
});
|
|
176
|
+
exports.Menu.displayName = 'HyperMenu';
|
|
177
|
+
function MenuItemRow({ item, first, last, selected, onSelect, }) {
|
|
178
|
+
const theme = (0, theme_1.useTheme)();
|
|
179
|
+
const pressed = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
180
|
+
const motion = (0, useGlassPressMotion_1.useGlassPressMotion)(0, 0, 0.5);
|
|
181
|
+
const reducedMotion = (0, MotionProvider_1.useReducedMotionPreference)();
|
|
182
|
+
const interactive = !item.disabled;
|
|
183
|
+
const titleColor = item.disabled
|
|
184
|
+
? theme.colors.disabledOnSecondaryVariant
|
|
185
|
+
: selected
|
|
186
|
+
? theme.colors.primary
|
|
187
|
+
: theme.colors.onGlass;
|
|
188
|
+
const summaryColor = item.disabled
|
|
189
|
+
? theme.colors.disabledOnSecondaryVariant
|
|
190
|
+
: selected
|
|
191
|
+
? theme.colors.primary
|
|
192
|
+
: theme.colors.onGlassSecondary;
|
|
193
|
+
const scaleStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
194
|
+
transform: [{ scale: reducedMotion ? 1 : (0, react_native_reanimated_1.withSpring)(pressed.value ? 0.99 : 1, { damping: 24, stiffness: 520, mass: 0.7 }) }],
|
|
195
|
+
}), [pressed, reducedMotion]);
|
|
196
|
+
const glassStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
197
|
+
opacity: reducedMotion ? pressed.value : (0, react_native_reanimated_1.withTiming)(pressed.value, { duration: 120 }),
|
|
198
|
+
}), [pressed, reducedMotion]);
|
|
199
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { accessibilityRole: "menuitem", accessibilityState: { disabled: !interactive, selected }, disabled: !interactive, onPress: onSelect, onPressIn: interactive ? (event) => { pressed.value = 1; motion.onPressIn(event); } : undefined, onTouchMove: interactive ? motion.onTouchMove : undefined, onPressOut: interactive ? (event) => { pressed.value = 0; motion.onPressOut(event); } : undefined, style: { backgroundColor: 'transparent' }, children: (0, jsx_runtime_1.jsxs)(react_native_reanimated_1.default.View, { style: [
|
|
200
|
+
{
|
|
201
|
+
flexDirection: 'row',
|
|
202
|
+
alignItems: 'center',
|
|
203
|
+
paddingHorizontal: ITEM_PADDING_HORIZONTAL,
|
|
204
|
+
paddingTop: first ? ITEM_PADDING_VERTICAL_EDGE : ITEM_PADDING_VERTICAL_MIDDLE,
|
|
205
|
+
paddingBottom: last ? ITEM_PADDING_VERTICAL_EDGE : ITEM_PADDING_VERTICAL_MIDDLE,
|
|
206
|
+
backgroundColor: selected
|
|
207
|
+
? (theme.dark ? 'rgba(10,132,255,0.16)' : 'rgba(0,136,255,0.10)')
|
|
208
|
+
: 'transparent',
|
|
209
|
+
},
|
|
210
|
+
scaleStyle,
|
|
211
|
+
], children: [theme.glass.enabled && interactive ? ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "none", style: [react_native_1.StyleSheet.absoluteFill, glassStyle], children: (0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "control", positioning: "inFlow", sampling: "backdrop", samplingSource: "themeBackdrop", inlineBackdrop: true, pointerEvents: "none", pointerEvent: motion.pointerEvent, pointerEventValue: motion.pointerEventValue, pointerEventSink: motion.pointerEventSink, opticalProgress: motion.progress, materialOverrides: { ...glassControlMaterial_1.glassControlMaterial, radius: 12, shadowOpacity: 0,
|
|
212
|
+
surfaceColor: { light: 'rgba(255,255,255,0.18)', dark: 'rgba(255,255,255,0.12)' } }, style: react_native_1.StyleSheet.absoluteFill }) })) : null, interactive && (0, jsx_runtime_1.jsx)(primitives_1.PressIndication, { pressed: pressed, color: theme.colors.onGlass, intensity: 0.12 }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { flex: 1, minWidth: 0, maxWidth: 216 }, children: [(0, jsx_runtime_1.jsx)(primitives_1.Text, { type: "body1", weight: "medium", color: titleColor, numberOfLines: 1, children: item.label }), item.summary != null && ((0, jsx_runtime_1.jsx)(primitives_1.Text, { type: "body2", color: summaryColor, numberOfLines: 1, children: item.summary }))] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: { width: 20, marginLeft: 12, alignItems: 'center', justifyContent: 'center', opacity: selected ? 1 : 0 }, children: (0, jsx_runtime_1.jsx)(primitives_1.Icon, { name: "check", size: 20, color: theme.colors.primary }) })] }) }));
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=Menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../src/components/Menu.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAA4D;AAC5D,kDAA6D;AAC7D,sCAA2F;AAC3F,iDAAmG;AACnG,oCAAoC;AACpC,gEAA6D;AAC7D,6DAAsE;AACtE,iEAA8D;AAC9D,+CAAwE;AACxE,mFAAmE;AACnE,+CAA0H;AAC1H,mFAAsH;AAsCtH,MAAM,MAAM,GAAG,CAAC,CAAC;AACjB,MAAM,YAAY,GAAG,I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ACf,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.NavigationBar = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const react_native_1 = require("react-native");
|
|
10
|
+
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
11
|
+
const ReferenceTabBar_1 = require("./ReferenceTabBar");
|
|
12
|
+
const GlassSurface_1 = require("../GlassSurface");
|
|
13
|
+
/** In-flow navigation retains the public API and uses the reference glass bar. */
|
|
14
|
+
exports.NavigationBar = react_1.default.memo(function NavigationBar({ items = [], selected = 0, onSelect, renderIcon }) {
|
|
15
|
+
const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
16
|
+
const backdropId = (0, GlassSurface_1.useGlassSamplingProviderId)('themeBackdrop');
|
|
17
|
+
return (0, jsx_runtime_1.jsx)(react_native_1.View, { style: { width: '100%', paddingHorizontal: 16, paddingBottom: insets.bottom + 8 }, children: (0, jsx_runtime_1.jsx)(ReferenceTabBar_1.ReferenceTabBar, { items: items, selected: selected, onSelect: index => onSelect?.(index), samplingProviderIdOverride: backdropId, renderIcon: renderIcon ? (index, active) => renderIcon(items[index], index, active) : undefined }) });
|
|
18
|
+
});
|
|
19
|
+
exports.NavigationBar.displayName = 'LiquidGlassNavigationBar';
|
|
20
|
+
//# sourceMappingURL=NavigationBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationBar.js","sourceRoot":"","sources":["../../../src/components/NavigationBar.tsx"],"names":[],"mappings":";;;;;;;AAAA,kDAA0B;AAE1B,+CAAoC;AACpC,mFAAmE;AACnE,uDAAoD;AACpD,kDAA6D;AAW7D,kFAAkF;AACrE,QAAA,aAAa,GAAG,eAAK,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,QAAQ,GAAG,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAyB;IACpI,MAAM,MAAM,GAAG,IAAA,kDAAiB,GAAE,CAAC;IACnC,MAAM,UAAU,GAAG,IAAA,yCAA0B,EAAC,eAAe,CAAC,CAAC;IAC/D,OAAO,uBAAC,mBAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,YAC1F,uBAAC,iCAAe,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EACnF,0BAA0B,EAAE,UAAU,EACtC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,GAAI,GACpG,CAAC;AACZ,CAAC,CAAC,CAAC;AACH,qBAAa,CAAC,WAAW,GAAG,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,273 @@
|
|
|
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
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
|
+
const primitives_1 = require("../primitives");
|
|
38
|
+
const GlassSurface_1 = require("../GlassSurface");
|
|
39
|
+
const useGlassPressMotion_1 = require("../useGlassPressMotion");
|
|
40
|
+
const MotionProvider_1 = require("../motion/MotionProvider");
|
|
41
|
+
const glassControlMaterial_1 = require("./glassControlMaterial");
|
|
42
|
+
const theme_1 = require("../theme");
|
|
43
|
+
const react_1 = __importStar(require("react"));
|
|
44
|
+
const react_native_1 = require("react-native");
|
|
45
|
+
const react_native_gesture_handler_1 = require("react-native-gesture-handler");
|
|
46
|
+
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
47
|
+
// Miuix NumberPicker: 45dp rows and five visible rows.
|
|
48
|
+
const ITEM_HEIGHT = 45;
|
|
49
|
+
const VISIBLE_ITEM_COUNT = 5;
|
|
50
|
+
const HALF_VISIBLE_COUNT = Math.floor(VISIBLE_ITEM_COUNT / 2);
|
|
51
|
+
const FLING_FRICTION = 8.4;
|
|
52
|
+
const SPRING_CONFIG = {
|
|
53
|
+
damping: 42,
|
|
54
|
+
mass: 0.7,
|
|
55
|
+
overshootClamping: true,
|
|
56
|
+
stiffness: 520,
|
|
57
|
+
};
|
|
58
|
+
const WheelItem = (0, react_1.memo)(function WheelItem({ index, value, currentIndex, offset, color }) {
|
|
59
|
+
const itemStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
60
|
+
// `distance` is measured in rows from the centered item. This is the
|
|
61
|
+
// same scale/alpha curve used by miuix-vue's NumberPicker.
|
|
62
|
+
// The offset follows the finger: moving up produces a positive offset,
|
|
63
|
+
// so the content also moves up instead of exposing an empty area.
|
|
64
|
+
const distance = index - currentIndex.value - offset.value;
|
|
65
|
+
const normalizedDistance = Math.min(Math.abs(distance) / (HALF_VISIBLE_COUNT + 0.5), 1);
|
|
66
|
+
const alpha = (1 - normalizedDistance) *
|
|
67
|
+
(1 - normalizedDistance * 0.5) *
|
|
68
|
+
(1 - normalizedDistance * 0.2);
|
|
69
|
+
const scale = 1 - normalizedDistance * 0.2;
|
|
70
|
+
return {
|
|
71
|
+
opacity: alpha,
|
|
72
|
+
transform: [{ translateY: distance * ITEM_HEIGHT }, { scale }],
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "none", style: [
|
|
76
|
+
{
|
|
77
|
+
position: 'absolute',
|
|
78
|
+
top: (ITEM_HEIGHT * VISIBLE_ITEM_COUNT) / 2,
|
|
79
|
+
left: 0,
|
|
80
|
+
right: 0,
|
|
81
|
+
height: ITEM_HEIGHT,
|
|
82
|
+
marginTop: -ITEM_HEIGHT / 2,
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
},
|
|
86
|
+
itemStyle,
|
|
87
|
+
], children: (0, jsx_runtime_1.jsx)(primitives_1.Text, { type: "title1", weight: "semibold", color: color, children: value }) }));
|
|
88
|
+
});
|
|
89
|
+
const NumberWheel = react_1.default.memo(function NumberWheel({ value, min = 0, max, step = 5, accessibilityLabel = 'Number picker', onChange, }) {
|
|
90
|
+
const theme = (0, theme_1.useTheme)();
|
|
91
|
+
const reducedMotion = (0, MotionProvider_1.useReducedMotionPreference)();
|
|
92
|
+
const motion = (0, useGlassPressMotion_1.useGlassPressMotion)(0, 0, 0.5);
|
|
93
|
+
const [recording, setRecording] = (0, react_1.useState)(false);
|
|
94
|
+
const settleTimer = (0, react_1.useRef)(null);
|
|
95
|
+
(0, react_1.useEffect)(() => () => { if (settleTimer.current)
|
|
96
|
+
clearTimeout(settleTimer.current); }, []);
|
|
97
|
+
const beginInteraction = (0, react_1.useCallback)((x, y) => {
|
|
98
|
+
if (settleTimer.current)
|
|
99
|
+
clearTimeout(settleTimer.current);
|
|
100
|
+
setRecording(true);
|
|
101
|
+
if (!reducedMotion)
|
|
102
|
+
motion.emitPointerDown(x, Math.max(0, Math.min(ITEM_HEIGHT, y - ITEM_HEIGHT * HALF_VISIBLE_COUNT)), Date.now());
|
|
103
|
+
}, [motion.emitPointerDown, reducedMotion]);
|
|
104
|
+
const endInteraction = (0, react_1.useCallback)(() => {
|
|
105
|
+
if (!reducedMotion)
|
|
106
|
+
motion.emitPointerUp(motion.pointX.value, motion.pointY.value, Date.now());
|
|
107
|
+
if (settleTimer.current)
|
|
108
|
+
clearTimeout(settleTimer.current);
|
|
109
|
+
settleTimer.current = setTimeout(() => { settleTimer.current = null; setRecording(false); }, 750);
|
|
110
|
+
}, [motion.emitPointerUp, motion.pointX, motion.pointY, reducedMotion]);
|
|
111
|
+
const values = (0, react_1.useMemo)(() => {
|
|
112
|
+
// A non-positive or non-finite step never advances a `current += step`
|
|
113
|
+
// loop. Fall back to unit steps so malformed input cannot hang rendering.
|
|
114
|
+
const interval = Number.isFinite(step) && step > 0 ? step : 1;
|
|
115
|
+
if (!Number.isFinite(min) || !Number.isFinite(max) || max < min)
|
|
116
|
+
return [Number.isFinite(min) ? min : 0];
|
|
117
|
+
const ratio = (max - min) / interval;
|
|
118
|
+
const lastIndex = Math.floor(ratio + Number.EPSILON * Math.max(1, Math.abs(ratio)) * 4);
|
|
119
|
+
const result = Array.from({ length: lastIndex + 1 }, (_, index) => min + index * interval);
|
|
120
|
+
return result.length > 0 ? result : [min];
|
|
121
|
+
}, [max, min, step]);
|
|
122
|
+
// The displayed wheel must remain aligned to a legal step when its owner
|
|
123
|
+
// supplies an in-between value (for example value=7 with step=5). Falling
|
|
124
|
+
// back to index 0 made every non-step value jump to the beginning of the
|
|
125
|
+
// range, even when the nearest row was right beside it.
|
|
126
|
+
const selectedIndex = Number.isFinite(value)
|
|
127
|
+
? values.reduce((nearest, candidate, index) => Math.abs(candidate - value) < Math.abs(values[nearest] - value) ? index : nearest, 0)
|
|
128
|
+
: 0;
|
|
129
|
+
const currentIndex = (0, react_native_reanimated_1.useSharedValue)(selectedIndex);
|
|
130
|
+
const offset = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
131
|
+
const startOffset = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
132
|
+
const dragging = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
133
|
+
(0, react_1.useEffect)(() => {
|
|
134
|
+
currentIndex.value = selectedIndex;
|
|
135
|
+
offset.value = 0;
|
|
136
|
+
}, [currentIndex, offset, selectedIndex]);
|
|
137
|
+
const commit = (0, react_1.useCallback)((rowOffset) => {
|
|
138
|
+
const nextIndex = Math.max(0, Math.min(values.length - 1, selectedIndex + Math.round(rowOffset)));
|
|
139
|
+
currentIndex.value = nextIndex;
|
|
140
|
+
offset.value = 0;
|
|
141
|
+
const nextValue = values[nextIndex];
|
|
142
|
+
if (nextValue !== value)
|
|
143
|
+
onChange(nextValue);
|
|
144
|
+
}, [currentIndex, offset, onChange, selectedIndex, value, values]);
|
|
145
|
+
const onAccessibilityAction = (0, react_1.useCallback)((event) => {
|
|
146
|
+
if (event.nativeEvent.actionName !== 'increment' && event.nativeEvent.actionName !== 'decrement')
|
|
147
|
+
return;
|
|
148
|
+
const direction = event.nativeEvent.actionName === 'increment' ? 1 : -1;
|
|
149
|
+
const nextIndex = Math.max(0, Math.min(values.length - 1, selectedIndex + direction));
|
|
150
|
+
const nextValue = values[nextIndex];
|
|
151
|
+
if (nextValue !== value)
|
|
152
|
+
onChange(nextValue);
|
|
153
|
+
}, [onChange, selectedIndex, value, values]);
|
|
154
|
+
const gesture = (0, react_1.useMemo)(() => {
|
|
155
|
+
const settle = (velocityY) => {
|
|
156
|
+
'worklet';
|
|
157
|
+
// Project the fling, then clamp before springing. This keeps
|
|
158
|
+
// the first and last values centered with no blank overscroll.
|
|
159
|
+
const projectedOffset = offset.value + (-velocityY / ITEM_HEIGHT) / FLING_FRICTION;
|
|
160
|
+
const minimum = -currentIndex.value;
|
|
161
|
+
const maximum = values.length - 1 - currentIndex.value;
|
|
162
|
+
const target = Math.max(minimum, Math.min(maximum, Math.round(projectedOffset)));
|
|
163
|
+
if (reducedMotion) {
|
|
164
|
+
offset.value = target;
|
|
165
|
+
(0, react_native_reanimated_1.runOnJS)(commit)(target);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
offset.value = (0, react_native_reanimated_1.withSpring)(target, SPRING_CONFIG, (finished) => {
|
|
169
|
+
if (finished)
|
|
170
|
+
(0, react_native_reanimated_1.runOnJS)(commit)(target);
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
const pan = react_native_gesture_handler_1.Gesture.Pan()
|
|
174
|
+
.activeOffsetY([-4, 4])
|
|
175
|
+
.maxPointers(1)
|
|
176
|
+
.onBegin((event) => { (0, react_native_reanimated_1.runOnJS)(beginInteraction)(event.x, event.y); })
|
|
177
|
+
.onStart(() => {
|
|
178
|
+
// A new drag must always start from the currently visible
|
|
179
|
+
// position; otherwise an interrupted spring can leave a gap.
|
|
180
|
+
(0, react_native_reanimated_1.cancelAnimation)(offset);
|
|
181
|
+
startOffset.value = offset.value;
|
|
182
|
+
dragging.value = (0, react_native_reanimated_1.withSpring)(1, { damping: 20, stiffness: 420 });
|
|
183
|
+
})
|
|
184
|
+
.onUpdate((event) => {
|
|
185
|
+
// Positive offset means the finger moved up. The rendered
|
|
186
|
+
// distance subtracts it, so the number layer follows the drag.
|
|
187
|
+
const rawOffset = startOffset.value - event.translationY / ITEM_HEIGHT;
|
|
188
|
+
const minimum = -currentIndex.value;
|
|
189
|
+
const maximum = values.length - 1 - currentIndex.value;
|
|
190
|
+
offset.value = Math.max(minimum, Math.min(maximum, rawOffset));
|
|
191
|
+
})
|
|
192
|
+
.onEnd((event) => {
|
|
193
|
+
dragging.value = (0, react_native_reanimated_1.withSpring)(0, { damping: 22, stiffness: 380 });
|
|
194
|
+
settle(event.velocityY);
|
|
195
|
+
})
|
|
196
|
+
.onFinalize((...finalizeArgs) => {
|
|
197
|
+
const success = finalizeArgs[1];
|
|
198
|
+
(0, react_native_reanimated_1.runOnJS)(endInteraction)();
|
|
199
|
+
dragging.value = (0, react_native_reanimated_1.withSpring)(0, { damping: 22, stiffness: 380 });
|
|
200
|
+
if (!success)
|
|
201
|
+
settle(0);
|
|
202
|
+
});
|
|
203
|
+
const tap = react_native_gesture_handler_1.Gesture.Tap()
|
|
204
|
+
.maxDuration(400)
|
|
205
|
+
.onEnd((event, success) => {
|
|
206
|
+
if (!success)
|
|
207
|
+
return;
|
|
208
|
+
const rowDelta = Math.round((event.y - (ITEM_HEIGHT * VISIBLE_ITEM_COUNT) / 2) / ITEM_HEIGHT);
|
|
209
|
+
if (rowDelta === 0)
|
|
210
|
+
return;
|
|
211
|
+
const minimum = -currentIndex.value;
|
|
212
|
+
const maximum = values.length - 1 - currentIndex.value;
|
|
213
|
+
const target = Math.max(minimum, Math.min(maximum, Math.round(offset.value) + rowDelta));
|
|
214
|
+
if (reducedMotion) {
|
|
215
|
+
offset.value = target;
|
|
216
|
+
(0, react_native_reanimated_1.runOnJS)(commit)(target);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
offset.value = (0, react_native_reanimated_1.withSpring)(target, SPRING_CONFIG, (finished) => {
|
|
220
|
+
if (finished)
|
|
221
|
+
(0, react_native_reanimated_1.runOnJS)(commit)(target);
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
return react_native_gesture_handler_1.Gesture.Race(pan, tap);
|
|
225
|
+
}, [beginInteraction, commit, currentIndex, dragging, endInteraction, offset, reducedMotion, startOffset, values.length]);
|
|
226
|
+
const accentItems = (0, react_1.useMemo)(() => values.map((item, index) => ((0, jsx_runtime_1.jsx)(WheelItem, { index: index, value: item, currentIndex: currentIndex, offset: offset, color: theme.colors.primary }, item))), [currentIndex, offset, theme.colors.primary, values]);
|
|
227
|
+
const items = (0, react_1.useMemo)(() => values.map((item, index) => ((0, jsx_runtime_1.jsx)(WheelItem, { index: index, value: item, currentIndex: currentIndex, offset: offset, color: theme.glass.enabled ? theme.colors.onGlass : theme.colors.onSurface }, item))), [currentIndex, offset, theme.colors.onGlass, theme.colors.onSurface, theme.glass.enabled, values]);
|
|
228
|
+
const wheelWidth = Math.max(108, String(values[values.length - 1]).length * 24 + 40);
|
|
229
|
+
const lensScaleStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
230
|
+
transform: [{ scaleX: reducedMotion ? 1 : 1 + 0.045 * dragging.value }, { scaleY: reducedMotion ? 1 : 1 + 0.06 * dragging.value }],
|
|
231
|
+
}), [dragging, reducedMotion]);
|
|
232
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: {
|
|
233
|
+
height: ITEM_HEIGHT * VISIBLE_ITEM_COUNT,
|
|
234
|
+
width: '100%',
|
|
235
|
+
alignItems: 'center',
|
|
236
|
+
justifyContent: 'center',
|
|
237
|
+
overflow: 'visible',
|
|
238
|
+
}, children: [theme.glass.enabled ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: { position: 'absolute', width: wheelWidth, height: '100%' }, children: (0, jsx_runtime_1.jsx)(GlassWheelVisual, { recording: recording, revision: `${value}:${min}:${max}:${step}:${theme.dark}`, normalItems: items, accentItems: accentItems, motion: motion, lensStyle: lensScaleStyle }) })) : (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "none", style: [
|
|
239
|
+
{
|
|
240
|
+
position: 'absolute',
|
|
241
|
+
top: ITEM_HEIGHT * HALF_VISIBLE_COUNT,
|
|
242
|
+
width: wheelWidth,
|
|
243
|
+
height: ITEM_HEIGHT,
|
|
244
|
+
borderRadius: ITEM_HEIGHT / 2,
|
|
245
|
+
overflow: 'hidden',
|
|
246
|
+
borderWidth: theme.glass.enabled ? 0.75 : react_native_1.StyleSheet.hairlineWidth,
|
|
247
|
+
borderColor: theme.glass.enabled
|
|
248
|
+
? (theme.dark ? 'rgba(255,255,255,0.28)' : 'rgba(255,255,255,0.82)')
|
|
249
|
+
: theme.colors.dividerLine,
|
|
250
|
+
},
|
|
251
|
+
lensScaleStyle,
|
|
252
|
+
] }), (0, jsx_runtime_1.jsx)(react_native_gesture_handler_1.GestureDetector, { gesture: gesture, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { accessible: true, accessibilityRole: "adjustable", accessibilityLabel: accessibilityLabel, accessibilityValue: { min: values[0], max: values[values.length - 1], now: values[selectedIndex] }, accessibilityActions: [{ name: 'increment' }, { name: 'decrement' }], onAccessibilityAction: onAccessibilityAction, style: { width: wheelWidth, height: '100%' }, children: !theme.glass.enabled ? (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: { width: '100%', height: '100%' }, children: items }) : null }) })] }));
|
|
253
|
+
});
|
|
254
|
+
NumberWheel.displayName = 'LiquidGlassNumberWheel';
|
|
255
|
+
exports.default = NumberWheel;
|
|
256
|
+
function GlassWheelVisual({ recording, revision, normalItems, accentItems, motion, lensStyle }) {
|
|
257
|
+
const scopeId = (0, react_1.useId)();
|
|
258
|
+
const parentSceneId = (0, GlassSurface_1.useGlassSamplingProviderId)('themeBackdrop');
|
|
259
|
+
const bodyMaterial = { ...glassControlMaterial_1.glassControlMaterial, referenceInteractionProfile: undefined,
|
|
260
|
+
radius: 20, shadowOpacity: 0, surfaceColor: { light: 'rgba(255,255,255,0.12)', dark: 'rgba(255,255,255,0.06)' } };
|
|
261
|
+
const body = (children) => (0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "control", positioning: "inFlow", sampling: "backdrop", inlineBackdrop: true, providerIdOverride: parentSceneId ?? '', materialOverrides: bodyMaterial, pointerEvents: "none", style: react_native_1.StyleSheet.absoluteFill, children: children });
|
|
262
|
+
return (0, jsx_runtime_1.jsxs)(GlassSurface_1.RouteGlassCaptureScope, { scopeId: scopeId, children: [(0, jsx_runtime_1.jsx)(GlassSurface_1.RouteGlassCaptureSource, { underlayProviderId: parentSceneId, sourceRevision: revision, captureMode: recording ? 'livePassThrough' : 'oneShotPassThrough', style: react_native_1.StyleSheet.absoluteFill, children: body(accentItems) }), body(normalItems), (0, jsx_runtime_1.jsx)(WheelLensConsumer, { children: (providerId) => (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [{
|
|
263
|
+
position: 'absolute', left: 0, right: 0, top: ITEM_HEIGHT * HALF_VISIBLE_COUNT, height: ITEM_HEIGHT,
|
|
264
|
+
}, lensStyle], children: (0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "control", positioning: "inFlow", sampling: "backdrop", inlineBackdrop: true, providerIdOverride: providerId, pointerEvents: "none", pointerEvent: motion.pointerEvent, pointerEventValue: motion.pointerEventValue, pointerEventSink: motion.pointerEventSink, opticalProgress: motion.progress, materialOverrides: { ...glassControlMaterial_1.glassControlMaterial, radius: ITEM_HEIGHT / 2,
|
|
265
|
+
referenceInteractionProfile: 'tab', refractionHeight: 10, refractionAmount: -14,
|
|
266
|
+
blurRadius: 0, chromaticAberration: 1,
|
|
267
|
+
surfaceColor: { light: 'rgba(255,255,255,0.08)', dark: 'rgba(255,255,255,0.08)' } }, style: react_native_1.StyleSheet.absoluteFill }) }) })] });
|
|
268
|
+
}
|
|
269
|
+
function WheelLensConsumer({ children }) {
|
|
270
|
+
const providerId = (0, GlassSurface_1.useGlassSamplingProviderId)('routeScene');
|
|
271
|
+
return (0, jsx_runtime_1.jsx)(GlassSurface_1.RouteGlassCaptureScope, { scopeId: "wheel-consumer", children: children(providerId ?? '') });
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=NumberWheel.js.map
|