@luckylca/react-native-liquid-glass 0.0.0-stage → 0.3.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 +294 -2
- package/README.zh-CN.md +297 -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/liquidglass/EffectiveScrollInputBridge.kt +47 -0
- package/android/src/main/java/expo/modules/liquidglass/GlassCaptureView.kt +1125 -0
- package/android/src/main/java/expo/modules/liquidglass/GlassRegistry.kt +75 -0
- package/android/src/main/java/expo/modules/liquidglass/GlassSurfaceView.kt +571 -0
- package/android/src/main/java/expo/modules/liquidglass/LiquidGlassModule.kt +205 -0
- package/android/src/main/java/expo/modules/liquidglass/LocalMaterialView.kt +138 -0
- package/android/src/main/java/expo/modules/liquidglass/PassSurfaceSuppression.kt +39 -0
- package/android/src/main/java/expo/modules/liquidglass/SharedGlassPassProbeLog.kt +23 -0
- package/android/src/main/java/expo/modules/liquidglass/SharedGlassPassWiring.kt +59 -0
- package/android-core/build.gradle +36 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/BackdropRecorder.kt +930 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/FrozenBackdrop.kt +66 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/GlassBackdropCoordinator.kt +624 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/GlassBackdropSourceHandle.kt +8 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/GlassScrollSource.kt +13 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/GlassViewController.kt +1002 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/LiquidGlassProviderLayout.kt +340 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/LiquidGlassView.kt +103 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/ReferenceSourceWindowPolicy.kt +13 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/StableSceneTexturePolicy.kt +43 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/SurfaceFrameBuilder.kt +278 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/SurfaceInteraction.kt +359 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/internal/GlassFrame.kt +110 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/internal/GlassViewRenderer.kt +728 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/internal/ReferenceParityPasses.kt +705 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/internal/ReferenceTabSampling.kt +15 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/internal/SharedSceneCapture.kt +163 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/GlassCapabilities.kt +21 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/GlassEngine.kt +131 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/GlassMaterial.kt +89 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/GlassMath.kt +131 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/GlassOpticalInsets.kt +8 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/GlassRenderTier.kt +54 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/GlassShapePacker.kt +77 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/GlassSurfaceState.kt +11 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/GlassUniforms.kt +113 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/LiquidGlassShaders.kt +234 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/SharedGlassPass.kt +456 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/geometry/G2RoundedRectangle.kt +207 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/geometry/ReferenceG2MaskTexture.kt +334 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/shader/HeightFieldGlassShader.kt +7 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/shader/ReferenceBackdropBlurShader.kt +58 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/shader/ReferenceGaussianDiscBackdropBlur.kt +42 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/shader/ReferenceGlassUniforms.kt +111 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/shader/ReferenceParityGlassShader.kt +613 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/shader/ReferenceParityMultiShapeShader.kt +128 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/shader/SdfScaleLensShader.kt +144 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/local/LocalGlassHardwareLayerExperiment.kt +29 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/local/LocalGlassMaterial.kt +14 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/local/LocalGlassRenderer.kt +126 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/local/LocalGlassRuntimeShader.kt +50 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/local/LocalGlassShader.kt +59 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/local/LocalGlassView.kt +47 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/motion/GlassMotionDriver.kt +824 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/motion/GlassMotionState.kt +359 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/motion/PointerVelocityTracker.kt +109 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/motion/SpringSpec.kt +209 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/optics/G2Corner.kt +194 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/optics/GlassMaterial.kt +250 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/optics/GlassOpticsShader.kt +696 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/optics/GlassParityProbe.kt +342 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/optics/GlassShapeGeometry.kt +317 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/optics/GlassUniformBinder.kt +308 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/optics/PixelDiff.kt +363 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/optics/ReferenceOptics.kt +568 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/rendering/GlassSurfaceHost.kt +317 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/rendering/GlassSurfaceRenderer.kt +847 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/rendering/RetainedBackdropLayer.kt +83 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/scheduler/GlassFrameScheduler.kt +27 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/telemetry/EffectiveScrollFpsProbe.kt +965 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/telemetry/GlassTelemetry.kt +16 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/telemetry/LiquidGlassPerfTelemetry.kt +676 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/telemetry/LiquidGlassTrace.kt +30 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/telemetry/LocalGlassTelemetry.kt +55 -0
- package/app.plugin.js +25 -0
- package/docs/architecture.md +61 -0
- package/docs/images/buttons.webp +0 -0
- package/docs/images/controls.webp +0 -0
- package/docs/images/tabs.webp +0 -0
- package/docs/migration-0.3.md +19 -0
- package/docs/publishing.md +106 -0
- package/expo-module.config.json +10 -0
- package/lib/commonjs/GlassSurface.js +404 -0
- package/lib/commonjs/GlassSurface.js.map +1 -0
- package/lib/commonjs/GlassTabBar.js +37 -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 +188 -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 +61 -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 +15 -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 +104 -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 +30 -0
- package/lib/commonjs/nativeGlassViews.js.map +1 -0
- package/lib/commonjs/performanceTelemetry.js +24 -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/surface/InlineSurface.js +134 -0
- package/lib/commonjs/surface/InlineSurface.js.map +1 -0
- package/lib/commonjs/surface/MaterialProvider.js +78 -0
- package/lib/commonjs/surface/MaterialProvider.js.map +1 -0
- package/lib/commonjs/surface/NativeSurface.js +55 -0
- package/lib/commonjs/surface/NativeSurface.js.map +1 -0
- package/lib/commonjs/surface/PortalLayers.js +331 -0
- package/lib/commonjs/surface/PortalLayers.js.map +1 -0
- package/lib/commonjs/surface/contexts.js +108 -0
- package/lib/commonjs/surface/contexts.js.map +1 -0
- package/lib/commonjs/surface/registry.js +113 -0
- package/lib/commonjs/surface/registry.js.map +1 -0
- package/lib/commonjs/surface/styles.js +34 -0
- package/lib/commonjs/surface/styles.js.map +1 -0
- package/lib/commonjs/surface/types.js +3 -0
- package/lib/commonjs/surface/types.js.map +1 -0
- package/lib/commonjs/surfaceRendererPolicy.js +32 -0
- package/lib/commonjs/surfaceRendererPolicy.js.map +1 -0
- package/lib/commonjs/tabs/GlassTabItem.js +66 -0
- package/lib/commonjs/tabs/GlassTabItem.js.map +1 -0
- package/lib/commonjs/tabs/InlineTabBar.js +867 -0
- package/lib/commonjs/tabs/InlineTabBar.js.map +1 -0
- package/lib/commonjs/tabs/tabConstants.js +22 -0
- package/lib/commonjs/tabs/tabConstants.js.map +1 -0
- package/lib/commonjs/tabs/tabDebug.js +50 -0
- package/lib/commonjs/tabs/tabDebug.js.map +1 -0
- package/lib/commonjs/tabs/tabStyles.js +107 -0
- package/lib/commonjs/tabs/tabStyles.js.map +1 -0
- package/lib/commonjs/tabs/useInlineTabGesture.js +227 -0
- package/lib/commonjs/tabs/useInlineTabGesture.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 +354 -0
- package/lib/module/GlassSurface.js.map +1 -0
- package/lib/module/GlassTabBar.js +32 -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 +185 -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 +54 -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 +10 -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 +94 -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 +24 -0
- package/lib/module/nativeGlassViews.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/performanceTelemetry.js +19 -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/surface/InlineSurface.js +97 -0
- package/lib/module/surface/InlineSurface.js.map +1 -0
- package/lib/module/surface/MaterialProvider.js +74 -0
- package/lib/module/surface/MaterialProvider.js.map +1 -0
- package/lib/module/surface/NativeSurface.js +47 -0
- package/lib/module/surface/NativeSurface.js.map +1 -0
- package/lib/module/surface/PortalLayers.js +292 -0
- package/lib/module/surface/PortalLayers.js.map +1 -0
- package/lib/module/surface/contexts.js +96 -0
- package/lib/module/surface/contexts.js.map +1 -0
- package/lib/module/surface/registry.js +103 -0
- package/lib/module/surface/registry.js.map +1 -0
- package/lib/module/surface/styles.js +31 -0
- package/lib/module/surface/styles.js.map +1 -0
- package/lib/module/surface/types.js +2 -0
- package/lib/module/surface/types.js.map +1 -0
- package/lib/module/surfaceRendererPolicy.js +27 -0
- package/lib/module/surfaceRendererPolicy.js.map +1 -0
- package/lib/module/tabs/GlassTabItem.js +30 -0
- package/lib/module/tabs/GlassTabItem.js.map +1 -0
- package/lib/module/tabs/InlineTabBar.js +829 -0
- package/lib/module/tabs/InlineTabBar.js.map +1 -0
- package/lib/module/tabs/tabConstants.js +19 -0
- package/lib/module/tabs/tabConstants.js.map +1 -0
- package/lib/module/tabs/tabDebug.js +13 -0
- package/lib/module/tabs/tabDebug.js.map +1 -0
- package/lib/module/tabs/tabStyles.js +104 -0
- package/lib/module/tabs/tabStyles.js.map +1 -0
- package/lib/module/tabs/useInlineTabGesture.js +221 -0
- package/lib/module/tabs/useInlineTabGesture.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 +147 -0
- package/lib/types/GlassTabBar.d.ts +36 -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 +10 -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 +112 -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/surface/InlineSurface.d.ts +42 -0
- package/lib/types/surface/MaterialProvider.d.ts +46 -0
- package/lib/types/surface/NativeSurface.d.ts +11 -0
- package/lib/types/surface/PortalLayers.d.ts +33 -0
- package/lib/types/surface/contexts.d.ts +66 -0
- package/lib/types/surface/registry.d.ts +6 -0
- package/lib/types/surface/styles.d.ts +74 -0
- package/lib/types/surface/types.d.ts +118 -0
- package/lib/types/surfaceRendererPolicy.d.ts +14 -0
- package/lib/types/tabs/GlassTabItem.d.ts +20 -0
- package/lib/types/tabs/InlineTabBar.d.ts +5 -0
- package/lib/types/tabs/tabConstants.d.ts +34 -0
- package/lib/types/tabs/tabDebug.d.ts +15 -0
- package/lib/types/tabs/tabStyles.d.ts +119 -0
- package/lib/types/tabs/useInlineTabGesture.d.ts +34 -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 +131 -4
- package/src/GlassSurface.tsx +676 -0
- package/src/GlassTabBar.tsx +106 -0
- package/src/GlassTabLens.tsx +92 -0
- package/src/LiquidGlassProvider.tsx +135 -0
- package/src/LocalGlassMaterial.tsx +256 -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 +70 -0
- package/src/glassNativeEngine.ts +16 -0
- package/src/glassRuntime.ts +11 -0
- package/src/index.ts +199 -0
- package/src/inputPresentation.ts +32 -0
- package/src/localGlassTelemetry.ts +129 -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 +144 -0
- package/src/performanceTelemetry.ts +91 -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/surface/InlineSurface.tsx +299 -0
- package/src/surface/MaterialProvider.tsx +235 -0
- package/src/surface/NativeSurface.tsx +115 -0
- package/src/surface/PortalLayers.tsx +574 -0
- package/src/surface/contexts.tsx +188 -0
- package/src/surface/registry.ts +109 -0
- package/src/surface/styles.ts +31 -0
- package/src/surface/types.ts +139 -0
- package/src/surfaceRendererPolicy.ts +32 -0
- package/src/tabs/GlassTabItem.tsx +100 -0
- package/src/tabs/InlineTabBar.tsx +1193 -0
- package/src/tabs/tabConstants.ts +35 -0
- package/src/tabs/tabDebug.ts +29 -0
- package/src/tabs/tabStyles.ts +104 -0
- package/src/tabs/useInlineTabGesture.ts +306 -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
package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/SurfaceFrameBuilder.kt
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
package io.github.luckylca.liquidglass.backdrop
|
|
2
|
+
import io.github.luckylca.liquidglass.backdrop.GlassViewController.Companion.REFERENCE_PROFILE_BUTTON
|
|
3
|
+
|
|
4
|
+
import android.graphics.Canvas
|
|
5
|
+
import android.graphics.Color
|
|
6
|
+
import android.graphics.Matrix
|
|
7
|
+
import android.graphics.RenderNode
|
|
8
|
+
import android.os.Build
|
|
9
|
+
import android.view.MotionEvent
|
|
10
|
+
import android.view.View
|
|
11
|
+
import androidx.annotation.ColorInt
|
|
12
|
+
import io.github.luckylca.liquidglass.core.GlassRenderTier
|
|
13
|
+
import io.github.luckylca.liquidglass.core.GlassOpticsModel
|
|
14
|
+
import io.github.luckylca.liquidglass.core.SdfScaleLensConfig
|
|
15
|
+
import io.github.luckylca.liquidglass.backdrop.internal.GlassFrame
|
|
16
|
+
import io.github.luckylca.liquidglass.backdrop.internal.GlassViewRenderer
|
|
17
|
+
import io.github.luckylca.liquidglass.telemetry.LiquidGlassPerfTelemetry
|
|
18
|
+
import io.github.luckylca.liquidglass.telemetry.LiquidGlassTrace
|
|
19
|
+
import kotlin.math.abs
|
|
20
|
+
import kotlin.math.cos
|
|
21
|
+
import kotlin.math.exp
|
|
22
|
+
import kotlin.math.min
|
|
23
|
+
import kotlin.math.sin
|
|
24
|
+
import kotlin.math.sqrt
|
|
25
|
+
|
|
26
|
+
/** Package-internal frame sampling helpers; state remains owned by the host. */
|
|
27
|
+
internal fun GlassViewController.buildFrame(): GlassFrame {
|
|
28
|
+
val density = host.resources.displayMetrics.density
|
|
29
|
+
val width = host.width.toFloat()
|
|
30
|
+
val height = host.height.toFloat()
|
|
31
|
+
val maxRadius = min(width, height) / 2f
|
|
32
|
+
val cornerRadiusPx = if (cornerRadiusDp < 0f) {
|
|
33
|
+
maxRadius
|
|
34
|
+
} else {
|
|
35
|
+
min(cornerRadiusDp * density, maxRadius)
|
|
36
|
+
}
|
|
37
|
+
val relative = relativeToProvider()
|
|
38
|
+
updateMotion(relative)
|
|
39
|
+
val backdrop = provider
|
|
40
|
+
val recordedOriginX = backdrop?.recordedOriginXFor(host) ?: 0
|
|
41
|
+
val recordedOriginY = backdrop?.recordedOriginYFor(host) ?: 0
|
|
42
|
+
frame.widthPx = width
|
|
43
|
+
frame.heightPx = height
|
|
44
|
+
frame.cornerRadiusPx = cornerRadiusPx
|
|
45
|
+
frame.shapeMaskText = shapeMaskText
|
|
46
|
+
frame.shapeMaskFontSizePx = shapeMaskFontSizeDp * density
|
|
47
|
+
frame.shapeMaskFontWeight = shapeMaskFontWeight
|
|
48
|
+
frame.progressiveBlurIntensity = progressiveBlurIntensity
|
|
49
|
+
frame.densityScale = density
|
|
50
|
+
frame.opticsModel = opticsModel
|
|
51
|
+
frame.dispersion = chromaticAberration
|
|
52
|
+
frame.sdfScaleLens = sdfScaleLens
|
|
53
|
+
frame.blurRadiusPx = blurRadiusDp * density
|
|
54
|
+
frame.backdropAlreadyBlurred = false
|
|
55
|
+
frame.refractionHeightPx = refractionHeightDp * density
|
|
56
|
+
frame.refractionAmountPx = refractionAmountDp * density
|
|
57
|
+
frame.referenceDepthEffect = referenceDepthEffect
|
|
58
|
+
frame.bodyRefractionAmountPx = bodyRefractionAmountDp * density
|
|
59
|
+
frame.contentScaleX = referenceContentScaleX
|
|
60
|
+
frame.contentScaleY = referenceContentScaleY
|
|
61
|
+
frame.contentOffsetXPx = referenceSampleOffsetXDp * density
|
|
62
|
+
frame.contentOffsetYPx = referenceSampleOffsetYDp * density
|
|
63
|
+
// For a value-driven control the press belongs to the motion driver, which
|
|
64
|
+
// integrates it alongside the value. Reading the controller's own press
|
|
65
|
+
// spring here as well would give the same quantity two authors and make the
|
|
66
|
+
// thumb's scale disagree with the rail it magnifies.
|
|
67
|
+
val driverOwnsPress = supportsNativeOptics &&
|
|
68
|
+
(Build.VERSION.SDK_INT >= 33) &&
|
|
69
|
+
referenceInteractionProfile != 0 && engine.motion.hasInput
|
|
70
|
+
frame.interactionProgress = if (driverOwnsPress) {
|
|
71
|
+
engine.motion.state.pressProgress
|
|
72
|
+
} else {
|
|
73
|
+
maxOf(interactionProgress, pressAmount)
|
|
74
|
+
}
|
|
75
|
+
val buttonDriverOwnsMotion = hasReferenceButtonMotion()
|
|
76
|
+
val interactionScale = if (buttonDriverOwnsMotion) {
|
|
77
|
+
Pair(engine.motion.state.deformationScaleX, engine.motion.state.deformationScaleY)
|
|
78
|
+
} else {
|
|
79
|
+
interactionScale()
|
|
80
|
+
}
|
|
81
|
+
if (buttonDriverOwnsMotion) applyInteractionTransform()
|
|
82
|
+
frame.layerScaleX = interactionScale.first
|
|
83
|
+
frame.layerScaleY = interactionScale.second
|
|
84
|
+
// A travelling knob's offset belongs to the motion state, which is the single
|
|
85
|
+
// writer of the value. Reading it here rather than trusting host.translationX
|
|
86
|
+
// means a knob that was never touched still opens at its value: a controlled
|
|
87
|
+
// slider publishes a value during layout, before any gesture exists.
|
|
88
|
+
val motionKind = engine.motion.kindOf()
|
|
89
|
+
// TAB_LENS belongs here with the other travelling knobs: its View moves by the
|
|
90
|
+
// same motion state, and leaving it out pinned the tab lens to the first tab
|
|
91
|
+
// forever — measured on device, native received travel=820.5 while the lens
|
|
92
|
+
// stayed put and the accent copy showed through a glass parked at tab 0.
|
|
93
|
+
val travels = motionKind == io.github.luckylca.liquidglass.motion.GlassInteractionKind.SLIDER_KNOB ||
|
|
94
|
+
motionKind == io.github.luckylca.liquidglass.motion.GlassInteractionKind.TOGGLE_KNOB ||
|
|
95
|
+
motionKind == io.github.luckylca.liquidglass.motion.GlassInteractionKind.TAB_LENS
|
|
96
|
+
if (travels && supportsNativeOptics) {
|
|
97
|
+
host.translationX = engine.motion.state.translationX
|
|
98
|
+
host.translationY = engine.motion.state.translationY
|
|
99
|
+
}
|
|
100
|
+
frame.layerTranslationXPx = host.translationX
|
|
101
|
+
frame.layerTranslationYPx = host.translationY
|
|
102
|
+
frame.saturation = saturation
|
|
103
|
+
frame.brightness = brightness
|
|
104
|
+
frame.contrast = contrast
|
|
105
|
+
frame.tintColor = glassTintColor
|
|
106
|
+
frame.tintAlpha = tintAlpha
|
|
107
|
+
frame.surfaceColor = glassSurfaceColor
|
|
108
|
+
frame.referenceHighlightStyle = referenceHighlightStyle
|
|
109
|
+
frame.referenceHighlightFalloff = referenceHighlightFalloff
|
|
110
|
+
frame.referenceHighlightColor = referenceHighlightColor
|
|
111
|
+
frame.referenceInteractionProfile = referenceInteractionProfile
|
|
112
|
+
// The rail's colour, the thumb's offset and the magnified track all read this
|
|
113
|
+
// one fraction. Taking it from the motion driver keeps them on the same spring
|
|
114
|
+
// as the press: previously the fraction came from a JS shared value and the
|
|
115
|
+
// press from a native spring, so a release animated the two independently and
|
|
116
|
+
// the colour arrived before the thumb.
|
|
117
|
+
frame.referenceToggleFraction = if (supportsNativeOptics &&
|
|
118
|
+
(Build.VERSION.SDK_INT >= 33) &&
|
|
119
|
+
referenceInteractionProfile != 0 && engine.motion.hasInput
|
|
120
|
+
) {
|
|
121
|
+
engine.motion.state.selectionProgress
|
|
122
|
+
} else {
|
|
123
|
+
referenceToggleFraction
|
|
124
|
+
}
|
|
125
|
+
frame.referenceToggleTrackColorOff = referenceToggleTrackColorOff ?: Color.TRANSPARENT
|
|
126
|
+
frame.referenceToggleTrackColorOn = referenceToggleTrackColorOn ?: Color.TRANSPARENT
|
|
127
|
+
frame.referenceToggleTrackWidthPx = referenceToggleTrackWidthDp * density
|
|
128
|
+
frame.referenceToggleTrackHeightPx = referenceToggleTrackHeightDp * density
|
|
129
|
+
frame.referenceToggleUseSolidBackdropColor = referenceToggleSolidBackdropColor != null
|
|
130
|
+
frame.referenceToggleSolidBackdropColor = referenceToggleSolidBackdropColor ?: Color.TRANSPARENT
|
|
131
|
+
frame.referenceToggleBackdropEnabled = referenceInteractionProfile == 1 &&
|
|
132
|
+
referenceToggleTrackColorOff != null && referenceToggleTrackColorOn != null &&
|
|
133
|
+
referenceToggleTrackWidthDp > 0f && referenceToggleTrackHeightDp > 0f
|
|
134
|
+
frame.referenceOverlayColor = Color.TRANSPARENT
|
|
135
|
+
frame.referenceOverlayAlpha = 0f
|
|
136
|
+
frame.referenceOverlayBlackAlpha = 0f
|
|
137
|
+
frame.chromaticAberration = chromaticAberration
|
|
138
|
+
frame.noiseAlpha = noiseAlpha
|
|
139
|
+
frame.highlightAlpha = if (referenceInteractionProfile == REFERENCE_PROFILE_BUTTON) {
|
|
140
|
+
highlightAlpha
|
|
141
|
+
} else {
|
|
142
|
+
highlightAlpha * (1f + pressAmount * 0.4f)
|
|
143
|
+
}
|
|
144
|
+
frame.specularStrength = specularStrength
|
|
145
|
+
frame.fresnelStrength = fresnelStrength
|
|
146
|
+
frame.innerShadowStrength = innerShadowStrength
|
|
147
|
+
frame.outerShadowAlpha = referenceOuterShadowAlpha
|
|
148
|
+
frame.outerShadowRadiusPx = referenceOuterShadowRadiusDp * density
|
|
149
|
+
frame.outerShadowOffsetYPx = referenceOuterShadowOffsetYDp * density
|
|
150
|
+
frame.highlightWidthPx = highlightWidthDp * density
|
|
151
|
+
if (opticsModel == GlassOpticsModel.REFERENCE_PARITY) {
|
|
152
|
+
val progress = frame.interactionProgress.coerceIn(0f, 1f)
|
|
153
|
+
when (referenceInteractionProfile) {
|
|
154
|
+
1, 2 -> {
|
|
155
|
+
// Toggle and slider backdrops remain at scene coordinates;
|
|
156
|
+
// the reference shader composites their optional scaled
|
|
157
|
+
// track layer independently around the current thumb.
|
|
158
|
+
frame.contentScaleX = 1f
|
|
159
|
+
frame.contentScaleY = 1f
|
|
160
|
+
frame.blurRadiusPx = blurRadiusDp * density * (1f - progress)
|
|
161
|
+
frame.refractionHeightPx *= progress
|
|
162
|
+
frame.refractionAmountPx *= progress
|
|
163
|
+
frame.highlightAlpha = highlightAlpha * progress
|
|
164
|
+
frame.innerShadowStrength *= progress
|
|
165
|
+
// The reference body has surfaceAlpha=0. Its solid white
|
|
166
|
+
// idle pebble is a POST-body SrcOver overlay, fading to
|
|
167
|
+
// zero while pressed, after any backdrop/inner shadow.
|
|
168
|
+
frame.referenceOverlayColor = Color.WHITE
|
|
169
|
+
frame.referenceOverlayAlpha = 1f - progress
|
|
170
|
+
frame.surfaceColor = Color.TRANSPARENT
|
|
171
|
+
}
|
|
172
|
+
3 -> {
|
|
173
|
+
// Both pinned references multiply lens depth/amount by
|
|
174
|
+
// press progress. Full refraction at rest pulled a second
|
|
175
|
+
// copy of the selected glyph into the capsule's top edge.
|
|
176
|
+
frame.blurRadiusPx = 0f
|
|
177
|
+
frame.refractionHeightPx *= progress
|
|
178
|
+
frame.refractionAmountPx *= progress
|
|
179
|
+
frame.highlightAlpha = highlightAlpha * progress
|
|
180
|
+
frame.innerShadowStrength *= progress
|
|
181
|
+
frame.outerShadowAlpha *= progress
|
|
182
|
+
// Reference indicator: 10% theme-aware idle dim overlay
|
|
183
|
+
// fades out, with a 3% black wash fading in on press.
|
|
184
|
+
frame.referenceOverlayColor = glassSurfaceColor
|
|
185
|
+
frame.referenceOverlayAlpha = Color.alpha(glassSurfaceColor) / 255f * (1f - progress)
|
|
186
|
+
frame.referenceOverlayBlackAlpha = 0.03f * progress
|
|
187
|
+
frame.surfaceColor = Color.TRANSPARENT
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
frame.displacementOnlyDebug = displacementOnlyDebug
|
|
192
|
+
frame.sdfDisplacementMapDebug = sdfDisplacementMapDebug
|
|
193
|
+
frame.lightAngleDegrees = lightAngleDegrees
|
|
194
|
+
frame.pressAmount = if (buttonDriverOwnsMotion) engine.motion.state.pressProgress else pressAmount
|
|
195
|
+
frame.pressX = if (referenceInteractionProfile == REFERENCE_PROFILE_BUTTON) forwardedPointerX else pressX
|
|
196
|
+
frame.pressY = if (referenceInteractionProfile == REFERENCE_PROFILE_BUTTON) forwardedPointerY else pressY
|
|
197
|
+
frame.relativeX = relative[0] - recordedOriginX
|
|
198
|
+
frame.relativeY = relative[1] - recordedOriginY
|
|
199
|
+
frame.motionX = motionX ?: derivedMotionX
|
|
200
|
+
frame.motionY = motionY ?: derivedMotionY
|
|
201
|
+
return frame
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
internal fun GlassViewController.updateMotion(relative: FloatArray) {
|
|
205
|
+
val now = System.nanoTime()
|
|
206
|
+
val previousX = previousRelativeX
|
|
207
|
+
val previousY = previousRelativeY
|
|
208
|
+
val elapsedSeconds = (now - previousMotionAtNanos) / 1_000_000_000f
|
|
209
|
+
if (previousX != null && previousY != null &&
|
|
210
|
+
(abs(relative[0] - previousX) > 0.5f || abs(relative[1] - previousY) > 0.5f)
|
|
211
|
+
) {
|
|
212
|
+
// Cropped providers need a new recording when the consumer moves.
|
|
213
|
+
// Full-scene providers (the Expo/RN host) only need new sampling
|
|
214
|
+
// coordinates, so avoid an otherwise redundant full-page re-record.
|
|
215
|
+
val backdrop = provider
|
|
216
|
+
if (!continuousBackdrop && backdrop?.requiresCaptureOnConsumerMovement == true) {
|
|
217
|
+
backdrop.requestCaptureFrame()
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (previousX != null && previousY != null && elapsedSeconds in 0.004f..0.12f) {
|
|
221
|
+
val density = host.resources.displayMetrics.density.coerceAtLeast(1f)
|
|
222
|
+
val targetX = (((relative[0] - previousX) / density) / elapsedSeconds / 1800f).coerceIn(-1f, 1f)
|
|
223
|
+
val targetY = (((relative[1] - previousY) / density) / elapsedSeconds / 1800f).coerceIn(-1f, 1f)
|
|
224
|
+
derivedMotionX = derivedMotionX * 0.62f + targetX * 0.38f
|
|
225
|
+
derivedMotionY = derivedMotionY * 0.62f + targetY * 0.38f
|
|
226
|
+
} else if (elapsedSeconds > 0.12f || previousX == null) {
|
|
227
|
+
derivedMotionX = 0f
|
|
228
|
+
derivedMotionY = 0f
|
|
229
|
+
}
|
|
230
|
+
previousRelativeX = relative[0]
|
|
231
|
+
previousRelativeY = relative[1]
|
|
232
|
+
previousMotionAtNanos = now
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
internal fun GlassViewController.relativeToProvider(): FloatArray {
|
|
236
|
+
val backdrop = provider
|
|
237
|
+
if (backdrop == null) {
|
|
238
|
+
relativePosition[0] = 0f
|
|
239
|
+
relativePosition[1] = 0f
|
|
240
|
+
return relativePosition
|
|
241
|
+
}
|
|
242
|
+
val previousX = relativePosition[0]
|
|
243
|
+
val previousY = relativePosition[1]
|
|
244
|
+
LiquidGlassPerfTelemetry.geometryLookup()
|
|
245
|
+
// Keep the consumer's layout origin separate from its own optical
|
|
246
|
+
// press matrix. The shader maps samples through that matrix itself so
|
|
247
|
+
// the sampled scene stays fixed while the glass layer grows.
|
|
248
|
+
locationInWindowWithoutHostTransform(host, locationSelf)
|
|
249
|
+
LiquidGlassPerfTelemetry.geometryLookup()
|
|
250
|
+
backdrop.getCachedSourceWindowOrigin(locationProvider)
|
|
251
|
+
relativePosition[0] = (locationSelf[0] - locationProvider[0]).toFloat()
|
|
252
|
+
relativePosition[1] = (locationSelf[1] - locationProvider[1]).toFloat()
|
|
253
|
+
if (previousX != relativePosition[0] || previousY != relativePosition[1]) {
|
|
254
|
+
if (!continuousBackdrop) {
|
|
255
|
+
backdrop.onConsumerGeometryChanged(
|
|
256
|
+
host,
|
|
257
|
+
relativePosition[0].toInt(),
|
|
258
|
+
relativePosition[1].toInt(),
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return relativePosition
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
internal fun GlassViewController.locationInWindowWithoutHostTransform(view: View, out: IntArray) {
|
|
266
|
+
val parent = view.parent as? View
|
|
267
|
+
if (parent == null) {
|
|
268
|
+
view.getLocationInWindow(out)
|
|
269
|
+
return
|
|
270
|
+
}
|
|
271
|
+
parentToWindow.reset()
|
|
272
|
+
parent.transformMatrixToGlobal(parentToWindow)
|
|
273
|
+
layoutOriginInWindow[0] = (view.left - parent.scrollX).toFloat()
|
|
274
|
+
layoutOriginInWindow[1] = (view.top - parent.scrollY).toFloat()
|
|
275
|
+
parentToWindow.mapPoints(layoutOriginInWindow)
|
|
276
|
+
out[0] = kotlin.math.round(layoutOriginInWindow[0]).toInt()
|
|
277
|
+
out[1] = kotlin.math.round(layoutOriginInWindow[1]).toInt()
|
|
278
|
+
}
|
package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/SurfaceInteraction.kt
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
package io.github.luckylca.liquidglass.backdrop
|
|
2
|
+
import io.github.luckylca.liquidglass.backdrop.GlassViewController.Companion.REFERENCE_PROFILE_BUTTON
|
|
3
|
+
import io.github.luckylca.liquidglass.backdrop.GlassViewController.Companion.BUTTON_SPRING_STIFFNESS
|
|
4
|
+
import io.github.luckylca.liquidglass.backdrop.GlassViewController.Companion.BUTTON_SPRING_DAMPING
|
|
5
|
+
import io.github.luckylca.liquidglass.backdrop.GlassViewController.Companion.CONTROL_SPRING_STIFFNESS
|
|
6
|
+
import io.github.luckylca.liquidglass.backdrop.GlassViewController.Companion.SPRING_SETTLE_THRESHOLD
|
|
7
|
+
|
|
8
|
+
import android.graphics.Canvas
|
|
9
|
+
import android.graphics.Color
|
|
10
|
+
import android.graphics.Matrix
|
|
11
|
+
import android.graphics.RenderNode
|
|
12
|
+
import android.os.Build
|
|
13
|
+
import android.view.MotionEvent
|
|
14
|
+
import android.view.View
|
|
15
|
+
import androidx.annotation.ColorInt
|
|
16
|
+
import io.github.luckylca.liquidglass.core.GlassRenderTier
|
|
17
|
+
import io.github.luckylca.liquidglass.core.GlassOpticsModel
|
|
18
|
+
import io.github.luckylca.liquidglass.core.SdfScaleLensConfig
|
|
19
|
+
import io.github.luckylca.liquidglass.backdrop.internal.GlassFrame
|
|
20
|
+
import io.github.luckylca.liquidglass.backdrop.internal.GlassViewRenderer
|
|
21
|
+
import io.github.luckylca.liquidglass.telemetry.LiquidGlassPerfTelemetry
|
|
22
|
+
import io.github.luckylca.liquidglass.telemetry.LiquidGlassTrace
|
|
23
|
+
import kotlin.math.abs
|
|
24
|
+
import kotlin.math.cos
|
|
25
|
+
import kotlin.math.exp
|
|
26
|
+
import kotlin.math.min
|
|
27
|
+
import kotlin.math.sin
|
|
28
|
+
import kotlin.math.sqrt
|
|
29
|
+
|
|
30
|
+
/** Package-internal interaction and rendering helpers; state remains owned by the host. */
|
|
31
|
+
internal fun GlassViewController.resetNativePress() {
|
|
32
|
+
host.removeCallbacks(pressAnimationFrame)
|
|
33
|
+
host.removeCallbacks(externalPressPointerBaselineFrame)
|
|
34
|
+
externalPressAwaitingPointerBaseline = false
|
|
35
|
+
pressStartedAtNanos = 0L
|
|
36
|
+
pointerDown = false
|
|
37
|
+
externalButtonProgress = 0f
|
|
38
|
+
pressAmount = 0f
|
|
39
|
+
pressVelocity = 0f
|
|
40
|
+
pressTarget = 0f
|
|
41
|
+
pressStartValue = 0f
|
|
42
|
+
pressStartVelocity = 0f
|
|
43
|
+
dragX = 0f
|
|
44
|
+
dragY = 0f
|
|
45
|
+
dragTargetX = 0f
|
|
46
|
+
dragTargetY = 0f
|
|
47
|
+
dragStartValueX = 0f
|
|
48
|
+
dragStartValueY = 0f
|
|
49
|
+
dragStartVelocityX = 0f
|
|
50
|
+
dragStartVelocityY = 0f
|
|
51
|
+
dragVelocityX = 0f
|
|
52
|
+
dragVelocityY = 0f
|
|
53
|
+
pointerVelocityXDpPerSecond = 0f
|
|
54
|
+
pointerVelocityYDpPerSecond = 0f
|
|
55
|
+
applyInteractionTransform()
|
|
56
|
+
host.invalidate()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
internal fun GlassViewController.beginExternalButtonPress() {
|
|
60
|
+
host.removeCallbacks(externalPressPointerBaselineFrame)
|
|
61
|
+
externalPressAwaitingPointerBaseline = true
|
|
62
|
+
dragX = 0f
|
|
63
|
+
dragY = 0f
|
|
64
|
+
dragTargetX = 0f
|
|
65
|
+
dragTargetY = 0f
|
|
66
|
+
dragVelocityX = 0f
|
|
67
|
+
dragVelocityY = 0f
|
|
68
|
+
pointerVelocityXDpPerSecond = 0f
|
|
69
|
+
pointerVelocityYDpPerSecond = 0f
|
|
70
|
+
pointerDown = true
|
|
71
|
+
// Keep the initial press stationary until the current Reanimated
|
|
72
|
+
// coordinates have both had a chance to reach the native view.
|
|
73
|
+
pressX = 0f
|
|
74
|
+
pressY = 0f
|
|
75
|
+
host.postOnAnimation(externalPressPointerBaselineFrame)
|
|
76
|
+
animatePress(1f)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
internal fun GlassViewController.captureExternalPressPointerBaseline() {
|
|
80
|
+
externalPressAwaitingPointerBaseline = false
|
|
81
|
+
val density = host.resources.displayMetrics.density
|
|
82
|
+
pressX = interactionPointXDp * density
|
|
83
|
+
pressY = interactionPointYDp * density
|
|
84
|
+
dragStartX = pressX
|
|
85
|
+
dragStartY = pressY
|
|
86
|
+
dragX = 0f
|
|
87
|
+
dragY = 0f
|
|
88
|
+
dragTargetX = 0f
|
|
89
|
+
dragTargetY = 0f
|
|
90
|
+
dragVelocityX = 0f
|
|
91
|
+
dragVelocityY = 0f
|
|
92
|
+
pointerVelocityXDpPerSecond = 0f
|
|
93
|
+
pointerVelocityYDpPerSecond = 0f
|
|
94
|
+
applyInteractionTransform()
|
|
95
|
+
reportConsumerDirty(GlassBackdropDirtyReason.OPTICS)
|
|
96
|
+
host.invalidate()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
internal fun GlassViewController.endExternalButtonPress() {
|
|
100
|
+
if (!pointerDown) return
|
|
101
|
+
if (externalPressAwaitingPointerBaseline) {
|
|
102
|
+
host.removeCallbacks(externalPressPointerBaselineFrame)
|
|
103
|
+
captureExternalPressPointerBaseline()
|
|
104
|
+
}
|
|
105
|
+
pointerDown = false
|
|
106
|
+
// The pinned reference snaps the pointer position during movement and
|
|
107
|
+
// releases it to a 300/0.5 spring with zero inherited pointer speed.
|
|
108
|
+
animatePress(target = 0f)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
internal fun GlassViewController.updateExternalButtonPointer() {
|
|
112
|
+
if (!pointerDown || referenceInteractionProfile != 0) return
|
|
113
|
+
if (externalPressAwaitingPointerBaseline) return
|
|
114
|
+
val density = host.resources.displayMetrics.density
|
|
115
|
+
pressX = interactionPointXDp * density
|
|
116
|
+
pressY = interactionPointYDp * density
|
|
117
|
+
dragX = pressX - dragStartX
|
|
118
|
+
dragY = pressY - dragStartY
|
|
119
|
+
dragTargetX = dragX
|
|
120
|
+
dragTargetY = dragY
|
|
121
|
+
applyInteractionTransform()
|
|
122
|
+
reportConsumerDirty(GlassBackdropDirtyReason.OPTICS)
|
|
123
|
+
host.invalidate()
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
internal fun GlassViewController.animatePress(target: Float, releaseDragVelocityX: Float? = null, releaseDragVelocityY: Float? = null) {
|
|
127
|
+
val now = System.nanoTime()
|
|
128
|
+
advancePressAnimation(now)
|
|
129
|
+
host.removeCallbacks(pressAnimationFrame)
|
|
130
|
+
pressTarget = target
|
|
131
|
+
pressStartValue = pressAmount
|
|
132
|
+
pressStartVelocity = pressVelocity
|
|
133
|
+
pressStartedAtNanos = now
|
|
134
|
+
if (referenceInteractionProfile == 0 && !pointerDown) {
|
|
135
|
+
dragTargetX = 0f
|
|
136
|
+
dragTargetY = 0f
|
|
137
|
+
}
|
|
138
|
+
dragStartValueX = dragX
|
|
139
|
+
dragStartValueY = dragY
|
|
140
|
+
dragStartVelocityX = releaseDragVelocityX ?: dragVelocityX
|
|
141
|
+
dragStartVelocityY = releaseDragVelocityY ?: dragVelocityY
|
|
142
|
+
dragVelocityX = dragStartVelocityX
|
|
143
|
+
dragVelocityY = dragStartVelocityY
|
|
144
|
+
val pressSettled = abs(pressStartValue - target) < SPRING_SETTLE_THRESHOLD && abs(pressVelocity) < SPRING_SETTLE_THRESHOLD
|
|
145
|
+
val dragSettled = referenceInteractionProfile != 0 || (
|
|
146
|
+
abs(dragStartValueX - dragTargetX) < SPRING_SETTLE_THRESHOLD &&
|
|
147
|
+
abs(dragStartValueY - dragTargetY) < SPRING_SETTLE_THRESHOLD &&
|
|
148
|
+
abs(dragVelocityX) < SPRING_SETTLE_THRESHOLD &&
|
|
149
|
+
abs(dragVelocityY) < SPRING_SETTLE_THRESHOLD
|
|
150
|
+
)
|
|
151
|
+
if (pressSettled && dragSettled) {
|
|
152
|
+
pressAmount = target
|
|
153
|
+
pressVelocity = 0f
|
|
154
|
+
pressStartedAtNanos = 0L
|
|
155
|
+
if (referenceInteractionProfile == 0 && !pointerDown) {
|
|
156
|
+
dragX = dragTargetX
|
|
157
|
+
dragY = dragTargetY
|
|
158
|
+
dragVelocityX = 0f
|
|
159
|
+
dragVelocityY = 0f
|
|
160
|
+
}
|
|
161
|
+
applyInteractionTransform()
|
|
162
|
+
reportConsumerDirty(GlassBackdropDirtyReason.OPTICS)
|
|
163
|
+
host.invalidate()
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
host.postOnAnimation(pressAnimationFrame)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
internal fun GlassViewController.advancePressAnimation(nowNanos: Long): Boolean {
|
|
170
|
+
if (pressStartedAtNanos == 0L) return false
|
|
171
|
+
val elapsed = ((nowNanos - pressStartedAtNanos).coerceAtLeast(0L) / 1_000_000_000.0).toFloat()
|
|
172
|
+
val (stiffness, damping) = when (referenceInteractionProfile) {
|
|
173
|
+
1, 2, 3 -> Pair(CONTROL_SPRING_STIFFNESS, 1f)
|
|
174
|
+
else -> Pair(BUTTON_SPRING_STIFFNESS, BUTTON_SPRING_DAMPING)
|
|
175
|
+
}
|
|
176
|
+
val omega = sqrt(stiffness)
|
|
177
|
+
val x0 = pressStartValue - pressTarget
|
|
178
|
+
val v0 = pressStartVelocity
|
|
179
|
+
val offset: Float
|
|
180
|
+
val velocity: Float
|
|
181
|
+
if (damping >= 1f) {
|
|
182
|
+
val decay = exp(-omega * elapsed)
|
|
183
|
+
offset = x0 * decay + (v0 + omega * x0) * elapsed * decay
|
|
184
|
+
velocity = -omega * x0 * decay + (v0 + omega * x0) * (decay - omega * elapsed * decay)
|
|
185
|
+
} else {
|
|
186
|
+
val omegaD = omega * sqrt(1f - damping * damping)
|
|
187
|
+
val decay = exp(-damping * omega * elapsed)
|
|
188
|
+
val cosWd = cos(omegaD * elapsed)
|
|
189
|
+
val sinWd = sin(omegaD * elapsed)
|
|
190
|
+
val b0 = (v0 + damping * omega * x0) / omegaD
|
|
191
|
+
offset = x0 * decay * cosWd + b0 * decay * sinWd
|
|
192
|
+
velocity = -damping * omega * offset + decay * (-x0 * omegaD * sinWd + b0 * omegaD * cosWd)
|
|
193
|
+
}
|
|
194
|
+
pressAmount = pressTarget + offset
|
|
195
|
+
pressVelocity = velocity
|
|
196
|
+
var dragXSettled = true
|
|
197
|
+
var dragYSettled = true
|
|
198
|
+
if (referenceInteractionProfile == 0) {
|
|
199
|
+
if (pointerDown) {
|
|
200
|
+
// The reference snaps both axes to the active pointer. Do not
|
|
201
|
+
// let the press spring's clock pull the drag point back toward
|
|
202
|
+
// the stale down position while the finger is moving.
|
|
203
|
+
dragX = dragTargetX
|
|
204
|
+
dragY = dragTargetY
|
|
205
|
+
dragVelocityX = 0f
|
|
206
|
+
dragVelocityY = 0f
|
|
207
|
+
} else {
|
|
208
|
+
val dragXResult = springValue(
|
|
209
|
+
dragStartValueX,
|
|
210
|
+
dragStartVelocityX,
|
|
211
|
+
dragTargetX,
|
|
212
|
+
elapsed,
|
|
213
|
+
BUTTON_SPRING_DAMPING,
|
|
214
|
+
)
|
|
215
|
+
dragX = dragXResult.first
|
|
216
|
+
dragVelocityX = dragXResult.second
|
|
217
|
+
val dragYResult = springValue(
|
|
218
|
+
dragStartValueY,
|
|
219
|
+
dragStartVelocityY,
|
|
220
|
+
dragTargetY,
|
|
221
|
+
elapsed,
|
|
222
|
+
BUTTON_SPRING_DAMPING,
|
|
223
|
+
)
|
|
224
|
+
dragY = dragYResult.first
|
|
225
|
+
dragVelocityY = dragYResult.second
|
|
226
|
+
dragXSettled = abs(dragX - dragTargetX) < SPRING_SETTLE_THRESHOLD && abs(dragVelocityX) < SPRING_SETTLE_THRESHOLD
|
|
227
|
+
dragYSettled = abs(dragY - dragTargetY) < SPRING_SETTLE_THRESHOLD && abs(dragVelocityY) < SPRING_SETTLE_THRESHOLD
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
val pressSettled = abs(offset) < SPRING_SETTLE_THRESHOLD && abs(velocity) < SPRING_SETTLE_THRESHOLD
|
|
231
|
+
if (pressSettled && dragXSettled && dragYSettled) {
|
|
232
|
+
pressAmount = pressTarget
|
|
233
|
+
pressVelocity = 0f
|
|
234
|
+
if (referenceInteractionProfile == 0) {
|
|
235
|
+
dragX = dragTargetX
|
|
236
|
+
dragY = dragTargetY
|
|
237
|
+
dragVelocityX = 0f
|
|
238
|
+
dragVelocityY = 0f
|
|
239
|
+
}
|
|
240
|
+
pressStartedAtNanos = 0L
|
|
241
|
+
return false
|
|
242
|
+
}
|
|
243
|
+
return true
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
internal fun GlassViewController.applyInteractionTransform() {
|
|
247
|
+
if (hasReferenceButtonMotion()) {
|
|
248
|
+
val motion = engine.motion.state
|
|
249
|
+
host.translationX = motion.translationX
|
|
250
|
+
host.translationY = motion.translationY
|
|
251
|
+
host.scaleX = motion.deformationScaleX
|
|
252
|
+
host.scaleY = motion.deformationScaleY
|
|
253
|
+
onInteractionTransformUpdated?.invoke(
|
|
254
|
+
host.translationX,
|
|
255
|
+
host.translationY,
|
|
256
|
+
host.scaleX,
|
|
257
|
+
host.scaleY,
|
|
258
|
+
)
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
val interactionScale = interactionScale()
|
|
262
|
+
if (referenceInteractionProfile == 0) {
|
|
263
|
+
val width = host.width.toFloat().coerceAtLeast(1f)
|
|
264
|
+
val height = host.height.toFloat().coerceAtLeast(1f)
|
|
265
|
+
val minDimension = min(width, height)
|
|
266
|
+
val safeDimension = minDimension.coerceAtLeast(1f)
|
|
267
|
+
host.translationX = minDimension * kotlin.math.tanh(0.05f * dragX / safeDimension)
|
|
268
|
+
host.translationY = minDimension * kotlin.math.tanh(0.05f * dragY / safeDimension)
|
|
269
|
+
host.scaleX = interactionScale.first
|
|
270
|
+
host.scaleY = interactionScale.second
|
|
271
|
+
} else {
|
|
272
|
+
// A knob's position is the motion state's, not a fixed zero. This branch
|
|
273
|
+
// used to clear the translation every frame, which is correct for a glass
|
|
274
|
+
// that stays where layout put it and wrong for one that travels: the value,
|
|
275
|
+
// the rail fill and the label all advanced while the lens stayed at the
|
|
276
|
+
// rail's start, because this line rewrote what the spring had produced.
|
|
277
|
+
val kindNow = engine.motion.kindOf()
|
|
278
|
+
val travelling = kindNow == io.github.luckylca.liquidglass.motion.GlassInteractionKind.SLIDER_KNOB ||
|
|
279
|
+
kindNow == io.github.luckylca.liquidglass.motion.GlassInteractionKind.TOGGLE_KNOB ||
|
|
280
|
+
kindNow == io.github.luckylca.liquidglass.motion.GlassInteractionKind.TAB_LENS
|
|
281
|
+
if (travelling && supportsNativeOptics) {
|
|
282
|
+
host.translationX = engine.motion.state.translationX
|
|
283
|
+
host.translationY = engine.motion.state.translationY
|
|
284
|
+
} else {
|
|
285
|
+
host.translationX = 0f
|
|
286
|
+
host.translationY = 0f
|
|
287
|
+
}
|
|
288
|
+
host.scaleX = interactionScale.first
|
|
289
|
+
host.scaleY = interactionScale.second
|
|
290
|
+
}
|
|
291
|
+
onInteractionTransformUpdated?.invoke(
|
|
292
|
+
host.translationX,
|
|
293
|
+
host.translationY,
|
|
294
|
+
host.scaleX,
|
|
295
|
+
host.scaleY,
|
|
296
|
+
)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
internal fun GlassViewController.hasReferenceButtonMotion(): Boolean =
|
|
300
|
+
referenceInteractionProfile == REFERENCE_PROFILE_BUTTON &&
|
|
301
|
+
supportsNativeOptics &&
|
|
302
|
+
(Build.VERSION.SDK_INT >= 33) &&
|
|
303
|
+
engine.motion.hasInput
|
|
304
|
+
|
|
305
|
+
/** Matches the View graphics-layer transform in applyInteractionTransform(). */
|
|
306
|
+
|
|
307
|
+
internal fun GlassViewController.interactionScale(): Pair<Float, Float> {
|
|
308
|
+
if (referenceInteractionProfile in 1..3) {
|
|
309
|
+
// Toggle/slider (pressedScale = 1.5) and tab lens (78/56) share the
|
|
310
|
+
// native DampedDragAnimation / VelocityTracker deformation spring.
|
|
311
|
+
// Reading it keeps both the View layer and the shader sample map in sync.
|
|
312
|
+
if (supportsNativeOptics &&
|
|
313
|
+
(Build.VERSION.SDK_INT >= 33) &&
|
|
314
|
+
engine.motion.hasInput
|
|
315
|
+
) {
|
|
316
|
+
return Pair(engine.motion.state.deformationScaleX, engine.motion.state.deformationScaleY)
|
|
317
|
+
}
|
|
318
|
+
val progress = maxOf(interactionProgress, pressAmount).coerceIn(0f, 1f)
|
|
319
|
+
val maxScale = if (referenceInteractionProfile == 3) 78f / 56f else 1.5f
|
|
320
|
+
val scale = 1f + (maxScale - 1f) * progress
|
|
321
|
+
return Pair(scale, scale)
|
|
322
|
+
}
|
|
323
|
+
if (referenceInteractionProfile != 0) {
|
|
324
|
+
val scale = 1f + 0.025f * pressAmount
|
|
325
|
+
return Pair(scale, scale)
|
|
326
|
+
}
|
|
327
|
+
val width = host.width.toFloat().coerceAtLeast(1f)
|
|
328
|
+
val height = host.height.toFloat().coerceAtLeast(1f)
|
|
329
|
+
val maxDimension = maxOf(width, height)
|
|
330
|
+
val pressScaleRatio = 4f / 48f
|
|
331
|
+
val scale = 1f + pressScaleRatio * pressAmount
|
|
332
|
+
val distance = sqrt(dragX * dragX + dragY * dragY)
|
|
333
|
+
val angle = kotlin.math.atan2(dragY, dragX)
|
|
334
|
+
val widthHeightCap = min(width / height, 1f)
|
|
335
|
+
val heightWidthCap = min(height / width, 1f)
|
|
336
|
+
return Pair(
|
|
337
|
+
scale + pressScaleRatio * abs(kotlin.math.cos(angle) * distance / maxDimension) * widthHeightCap,
|
|
338
|
+
scale + pressScaleRatio * abs(kotlin.math.sin(angle) * distance / maxDimension) * heightWidthCap,
|
|
339
|
+
)
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
internal fun GlassViewController.springValue(
|
|
343
|
+
start: Float,
|
|
344
|
+
startVelocity: Float,
|
|
345
|
+
target: Float,
|
|
346
|
+
elapsed: Float,
|
|
347
|
+
damping: Float,
|
|
348
|
+
): Pair<Float, Float> {
|
|
349
|
+
val omega = sqrt(BUTTON_SPRING_STIFFNESS)
|
|
350
|
+
val omegaD = omega * sqrt(1f - damping * damping)
|
|
351
|
+
val decay = exp(-damping * omega * elapsed)
|
|
352
|
+
val cosWd = cos(omegaD * elapsed)
|
|
353
|
+
val sinWd = sin(omegaD * elapsed)
|
|
354
|
+
val x0 = start - target
|
|
355
|
+
val b0 = (startVelocity + damping * omega * x0) / omegaD
|
|
356
|
+
val offset = x0 * decay * cosWd + b0 * decay * sinWd
|
|
357
|
+
val velocity = -damping * omega * offset + decay * (-x0 * omegaD * sinWd + b0 * omegaD * cosWd)
|
|
358
|
+
return Pair(target + offset, velocity)
|
|
359
|
+
}
|