@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
|
@@ -0,0 +1,824 @@
|
|
|
1
|
+
package io.github.luckylca.liquidglass.motion
|
|
2
|
+
|
|
3
|
+
import android.os.SystemClock
|
|
4
|
+
import android.view.Choreographer
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The single owner of a surface's interaction animation.
|
|
8
|
+
*
|
|
9
|
+
* Responsibilities, in order:
|
|
10
|
+
* 1. Accept pointer input and record it into a velocity tracker.
|
|
11
|
+
* 2. Choose target values from the input and the interaction kind.
|
|
12
|
+
* 3. Advance every spring under one timestamp.
|
|
13
|
+
* 4. Publish a [GlassMotionState] and stop the frame callback when settled.
|
|
14
|
+
*
|
|
15
|
+
* The "one timestamp" rule is the point. Shape position, scale, press progress
|
|
16
|
+
* and optical progress all advance from the same `frameTimeNanos`, so the
|
|
17
|
+
* silhouette and the refraction that follows it can never be a frame apart. The
|
|
18
|
+
* previous engine let Reanimated own `progress` on the UI runtime while the view
|
|
19
|
+
* controller ran its own closed-form spring on the same quantity; two clocks
|
|
20
|
+
* meant the rim light could be at full intensity while the body had not finished
|
|
21
|
+
* squashing.
|
|
22
|
+
*
|
|
23
|
+
* This class deliberately knows nothing about rendering. It reports that state
|
|
24
|
+
* changed and lets the caller invalidate, which keeps it testable without a View.
|
|
25
|
+
*/
|
|
26
|
+
public class GlassMotionDriver(
|
|
27
|
+
private val kind: GlassInteractionKind,
|
|
28
|
+
private val density: Float,
|
|
29
|
+
) {
|
|
30
|
+
|
|
31
|
+
/** Which deformation this driver runs. Read-only; the host installs one per kind. */
|
|
32
|
+
public fun kindOf(): GlassInteractionKind = kind
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
public val state: GlassMotionState = GlassMotionState()
|
|
36
|
+
|
|
37
|
+
/** Portable transform written by [evaluateTransform]. */
|
|
38
|
+
public val transform: LayerTransform = LayerTransform()
|
|
39
|
+
|
|
40
|
+
/** Called when a frame produced a new state that must be drawn. */
|
|
41
|
+
public var onFrame: (() -> Unit)? = null
|
|
42
|
+
|
|
43
|
+
/** Called once when the springs come to rest and the callback stops. */
|
|
44
|
+
public var onSettled: (() -> Unit)? = null
|
|
45
|
+
|
|
46
|
+
private val value = SpringState()
|
|
47
|
+
private val press = SpringState()
|
|
48
|
+
private val scaleX = SpringState()
|
|
49
|
+
private val scaleY = SpringState()
|
|
50
|
+
private val pointerX = SpringState()
|
|
51
|
+
private val pointerY = SpringState()
|
|
52
|
+
private val optical = SpringState()
|
|
53
|
+
private val dragVelocity = SpringState()
|
|
54
|
+
|
|
55
|
+
private val velocityTracker = PointerVelocityTracker()
|
|
56
|
+
|
|
57
|
+
private var valueSpec: SpringSpec = GlassSprings.value(GlassSprings.REST_THRESHOLD)
|
|
58
|
+
private var velocitySpec: SpringSpec = GlassSprings.velocity(GlassSprings.REST_THRESHOLD)
|
|
59
|
+
private var pressSpec: SpringSpec = if (kind == GlassInteractionKind.BUTTON) {
|
|
60
|
+
GlassSprings.highlightProgress
|
|
61
|
+
} else {
|
|
62
|
+
GlassSprings.pressProgress
|
|
63
|
+
}
|
|
64
|
+
private var scaleXSpec: SpringSpec = GlassSprings.scaleX
|
|
65
|
+
private var scaleYSpec: SpringSpec = GlassSprings.scaleY
|
|
66
|
+
private var pointerSpec: SpringSpec = GlassSprings.highlightPosition
|
|
67
|
+
private var opticalSpec: SpringSpec = if (kind == GlassInteractionKind.BUTTON) {
|
|
68
|
+
GlassSprings.highlightProgress
|
|
69
|
+
} else {
|
|
70
|
+
GlassSprings.pressProgress
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private var valueTarget = 0f
|
|
74
|
+
private var pressTarget = 0f
|
|
75
|
+
private var opticalTarget = 0f
|
|
76
|
+
private var scaleTarget = 1f
|
|
77
|
+
private var pointerTargetX = 0f
|
|
78
|
+
private var pointerTargetY = 0f
|
|
79
|
+
|
|
80
|
+
private var valueStart = 0f
|
|
81
|
+
private var valueVelocityStart = 0f
|
|
82
|
+
private var pressStart = 0f
|
|
83
|
+
private var pressVelocityStart = 0f
|
|
84
|
+
private var scaleXStart = 1f
|
|
85
|
+
private var scaleYStart = 1f
|
|
86
|
+
private var scaleXVelocityStart = 0f
|
|
87
|
+
private var scaleYVelocityStart = 0f
|
|
88
|
+
private var pointerXStart = 0f
|
|
89
|
+
private var pointerYStart = 0f
|
|
90
|
+
private var pointerXVelocityStart = 0f
|
|
91
|
+
private var pointerYVelocityStart = 0f
|
|
92
|
+
private var opticalStart = 0f
|
|
93
|
+
private var opticalVelocityStart = 0f
|
|
94
|
+
private var dragVelocityTarget = 0f
|
|
95
|
+
private var dragVelocityStart = 0f
|
|
96
|
+
private var dragVelocityVelocityStart = 0f
|
|
97
|
+
private var dragVelocityStartedAtNanos = -1L
|
|
98
|
+
private var lastValueEventNanos = -1L
|
|
99
|
+
|
|
100
|
+
private var startedAtNanos = 0L
|
|
101
|
+
private var hasAnimation = false
|
|
102
|
+
private var running = false
|
|
103
|
+
private var width = 0f
|
|
104
|
+
private var height = 0f
|
|
105
|
+
|
|
106
|
+
/** Distance the lens has travelled along its track, px. Set by travelling kinds. */
|
|
107
|
+
public var valueTravel: Float = 0f
|
|
108
|
+
|
|
109
|
+
/** Full length of the track the lens travels along, px. 0 until a caller sets it. */
|
|
110
|
+
public var trackLength: Float = 0f
|
|
111
|
+
set(value) {
|
|
112
|
+
field = value.coerceAtLeast(0f)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Resting scale the press springs drive toward, per reference component.
|
|
117
|
+
*
|
|
118
|
+
* A button leaves this at 1.0: the reference's `LiquidButton` takes its body
|
|
119
|
+
* scale from press progress inside `layerBlock`, not from a scale spring.
|
|
120
|
+
* The knobs and the tab lens instead own dedicated scale springs aiming at
|
|
121
|
+
* their pressed size (1.5 for both knobs, 78/56 for the tab lens), which is
|
|
122
|
+
* why those overshoot and the button does not.
|
|
123
|
+
*/
|
|
124
|
+
public var pressedScale: Float = 1f
|
|
125
|
+
set(value) {
|
|
126
|
+
val clamped = value.coerceAtLeast(0.01f)
|
|
127
|
+
if (field == clamped) return
|
|
128
|
+
field = clamped
|
|
129
|
+
if (scaleTarget != 1f || pressTarget == 1f) {
|
|
130
|
+
// Re-aim a press that is already in flight.
|
|
131
|
+
scaleTarget = clamped
|
|
132
|
+
retargetAll()
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private val evaluate = FloatArray(1)
|
|
137
|
+
private val evaluateVelocity = FloatArray(1)
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Frame source. Defaults to the real Choreographer; tests and headless
|
|
141
|
+
* callers replace it with a driver that calls [advance] directly, which is
|
|
142
|
+
* how the deterministic trace tests run without a device.
|
|
143
|
+
*/
|
|
144
|
+
public var frameScheduler: FrameScheduler = ChoreographerFrameScheduler()
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* True while a spring is still moving and frames are being requested.
|
|
148
|
+
*
|
|
149
|
+
* Exposed because "is this surface still animating" is the question a renderer
|
|
150
|
+
* and a test both need to ask, and the private flag is not it: a driver can have
|
|
151
|
+
* a live animation with no frame pending (between `advance` and the next
|
|
152
|
+
* schedule), so the flag alone under-reports.
|
|
153
|
+
*/
|
|
154
|
+
public val isAnimating: Boolean get() = hasAnimation
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Monotonic nanosecond clock used to seed and advance the springs.
|
|
158
|
+
*
|
|
159
|
+
* Injectable so tests drive a deterministic time base. The frame callback
|
|
160
|
+
* passes the Choreographer's own timestamp to [advance], but a retarget that
|
|
161
|
+
* happens between frames must be measured on the same clock or the elapsed
|
|
162
|
+
* time comes out negative and the animation silently freezes.
|
|
163
|
+
*/
|
|
164
|
+
public var clockNanos: () -> Long = { SystemClock.uptimeMillis() * 1_000_000L }
|
|
165
|
+
|
|
166
|
+
private var frameScheduled = false
|
|
167
|
+
|
|
168
|
+
/** Abstracts postFrameCallback so the driver is not bound to a live View tree. */
|
|
169
|
+
public interface FrameScheduler {
|
|
170
|
+
fun schedule(callback: Choreographer.FrameCallback)
|
|
171
|
+
fun cancel(callback: Choreographer.FrameCallback)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
private class ChoreographerFrameScheduler : FrameScheduler {
|
|
175
|
+
private val choreographer: Choreographer by lazy { Choreographer.getInstance() }
|
|
176
|
+
override fun schedule(callback: Choreographer.FrameCallback) {
|
|
177
|
+
choreographer.postFrameCallback(callback)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
override fun cancel(callback: Choreographer.FrameCallback) {
|
|
181
|
+
choreographer.removeFrameCallback(callback)
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
private val frameCallback = Choreographer.FrameCallback { frameTimeNanos ->
|
|
186
|
+
frameScheduled = false
|
|
187
|
+
if (!running) return@FrameCallback
|
|
188
|
+
// advance() already published, so the callback only has to decide
|
|
189
|
+
// whether to keep going.
|
|
190
|
+
val advanced = advance(frameTimeNanos)
|
|
191
|
+
if (advanced) {
|
|
192
|
+
onFrame?.invoke()
|
|
193
|
+
scheduleFrame()
|
|
194
|
+
} else {
|
|
195
|
+
running = false
|
|
196
|
+
hasAnimation = false
|
|
197
|
+
state.isSettled = true
|
|
198
|
+
onFrame?.invoke()
|
|
199
|
+
onSettled?.invoke()
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** The surface size in px; needed by the button deformation law. */
|
|
204
|
+
public fun setSize(width: Float, height: Float) {
|
|
205
|
+
if (this.width == width && this.height == height) return
|
|
206
|
+
this.width = width
|
|
207
|
+
this.height = height
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Replaces the spring table for this surface. Used when a material selects
|
|
212
|
+
* a different interaction feel; identity-equal specs are ignored so a
|
|
213
|
+
* per-frame property write does not restart the animation.
|
|
214
|
+
*/
|
|
215
|
+
public fun configureSprings(
|
|
216
|
+
press: SpringSpec? = null,
|
|
217
|
+
scaleX: SpringSpec? = null,
|
|
218
|
+
scaleY: SpringSpec? = null,
|
|
219
|
+
pointer: SpringSpec? = null,
|
|
220
|
+
optical: SpringSpec? = null,
|
|
221
|
+
) {
|
|
222
|
+
if (press != null && press != pressSpec) pressSpec = press
|
|
223
|
+
if (scaleX != null && scaleX != scaleXSpec) scaleXSpec = scaleX
|
|
224
|
+
if (scaleY != null && scaleY != scaleYSpec) scaleYSpec = scaleY
|
|
225
|
+
if (pointer != null && pointer != pointerSpec) pointerSpec = pointer
|
|
226
|
+
if (optical != null && optical != opticalSpec) opticalSpec = optical
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** True while the driver is advancing frames. */
|
|
230
|
+
public val isRunning: Boolean get() = running
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* True once a pointer or a programmatic press has driven this surface.
|
|
234
|
+
*
|
|
235
|
+
* The renderer needs to distinguish "this surface animates itself" from "this
|
|
236
|
+
* surface is a slave to a value coming from JS" — a toggle's lens is positioned
|
|
237
|
+
* by its selection fraction, not by a pointer. Before any input arrives the
|
|
238
|
+
* driver holds nothing authoritative, so the caller may seed it.
|
|
239
|
+
*/
|
|
240
|
+
public var hasInput: Boolean = false
|
|
241
|
+
private set
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Pointer down. Records the down point as the shape-local origin of the
|
|
245
|
+
* drag, clears stale velocity and retargets press + scale.
|
|
246
|
+
*
|
|
247
|
+
* The pointer offset reported to the deformation is measured *from the down
|
|
248
|
+
* point*, matching the reference's `InteractiveHighlight.offset`, which is
|
|
249
|
+
* `position - startPosition`. Using the absolute local coordinate instead
|
|
250
|
+
* would displace the body toward the screen corner on every press.
|
|
251
|
+
*/
|
|
252
|
+
public fun onPointerDown(localX: Float, localY: Float, eventTimeMillis: Long) {
|
|
253
|
+
syncToNow()
|
|
254
|
+
hasInput = true
|
|
255
|
+
velocityTracker.reset()
|
|
256
|
+
velocityTracker.add(eventTimeMillis, localX, localY)
|
|
257
|
+
downX = localX
|
|
258
|
+
downY = localY
|
|
259
|
+
pointerTargetX = 0f
|
|
260
|
+
pointerTargetY = 0f
|
|
261
|
+
state.pointerX = 0f
|
|
262
|
+
state.pointerY = 0f
|
|
263
|
+
state.velocityX = 0f
|
|
264
|
+
state.velocityY = 0f
|
|
265
|
+
pointerX.value = 0f
|
|
266
|
+
pointerY.value = 0f
|
|
267
|
+
pointerX.velocity = 0f
|
|
268
|
+
pointerY.velocity = 0f
|
|
269
|
+
pressTarget = 1f
|
|
270
|
+
opticalTarget = 1f
|
|
271
|
+
scaleTarget = pressedScale
|
|
272
|
+
pointerHeld = true
|
|
273
|
+
retargetAll()
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
private var downX = 0f
|
|
277
|
+
private var downY = 0f
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* True while the finger owns the pointer offset.
|
|
281
|
+
*
|
|
282
|
+
* During a drag the offset is written straight through to the pointer, so the
|
|
283
|
+
* pointer springs must not also advance: `advance` would overwrite the live
|
|
284
|
+
* position with an evaluation of the previous press's start values, and the
|
|
285
|
+
* body would fight the finger and keep a velocity it should not have at release.
|
|
286
|
+
*/
|
|
287
|
+
private var pointerHeld = false
|
|
288
|
+
|
|
289
|
+
/** Pointer moved. Updates the offset and the velocity estimate immediately. */
|
|
290
|
+
public fun onPointerMove(localX: Float, localY: Float, eventTimeMillis: Long) {
|
|
291
|
+
syncToNow()
|
|
292
|
+
velocityTracker.add(eventTimeMillis, localX, localY)
|
|
293
|
+
val velocity = velocityTracker.estimate()
|
|
294
|
+
state.velocityX = velocity.first
|
|
295
|
+
state.velocityY = velocity.second
|
|
296
|
+
pointerTargetX = localX - downX
|
|
297
|
+
pointerTargetY = localY - downY
|
|
298
|
+
// While the finger is down the offset must track it exactly; a spring
|
|
299
|
+
// here would make the body lag the finger and read as input delay.
|
|
300
|
+
pointerX.value = pointerTargetX
|
|
301
|
+
pointerY.value = pointerTargetY
|
|
302
|
+
pointerX.velocity = velocity.first
|
|
303
|
+
pointerY.velocity = velocity.second
|
|
304
|
+
publish()
|
|
305
|
+
onFrame?.invoke()
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Pointer up.
|
|
310
|
+
*
|
|
311
|
+
* The reference's `InteractiveHighlight` snaps the offset to the pointer on
|
|
312
|
+
* every drag event, and `snapTo` resets the Animatable's velocity to zero, so
|
|
313
|
+
* its release spring starts from rest rather than carrying the drag velocity.
|
|
314
|
+
* The offset therefore springs home from where the finger left it with no
|
|
315
|
+
* extra throw. Inheriting the drag velocity here made the body overshoot past
|
|
316
|
+
* its resting place, which the reference never does for a button.
|
|
317
|
+
*
|
|
318
|
+
* The tracked velocity is still reported on the state: it is what a knob
|
|
319
|
+
* consumes for its shear, and dropping it entirely would leave the toggle and
|
|
320
|
+
* slider without their velocity response.
|
|
321
|
+
*/
|
|
322
|
+
public fun onPointerUp(eventTimeMillis: Long) {
|
|
323
|
+
syncToNow()
|
|
324
|
+
velocityTracker.add(eventTimeMillis, downX + state.pointerX, downY + state.pointerY)
|
|
325
|
+
val velocity = velocityTracker.estimate()
|
|
326
|
+
state.velocityX = velocity.first
|
|
327
|
+
state.velocityY = velocity.second
|
|
328
|
+
pressTarget = 0f
|
|
329
|
+
opticalTarget = 0f
|
|
330
|
+
scaleTarget = 1f
|
|
331
|
+
// Release ownership first: the offset springs home from where the finger
|
|
332
|
+
// left it, so the spring's start value must be the live offset and not a
|
|
333
|
+
// re-evaluation of the drag's own start point.
|
|
334
|
+
pointerHeld = false
|
|
335
|
+
pointerTargetX = 0f
|
|
336
|
+
pointerTargetY = 0f
|
|
337
|
+
pointerX.velocity = 0f
|
|
338
|
+
pointerY.velocity = 0f
|
|
339
|
+
retargetAll()
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Applies a pointer event forwarded from the JS touch source.
|
|
344
|
+
*
|
|
345
|
+
* The surface's native view does not own the hit target in a portal layout —
|
|
346
|
+
* the control that draws is composited above the page while the pressable that
|
|
347
|
+
* accepts input lives in the page tree. So the JS side is an *event source*
|
|
348
|
+
* only: it reports where and when the finger is, and this driver remains the
|
|
349
|
+
* one and only place a spring is evaluated. Forwarding a progress value instead
|
|
350
|
+
* would put a second spring on the JS runtime and reintroduce the double
|
|
351
|
+
* animation this engine exists to remove.
|
|
352
|
+
*/
|
|
353
|
+
public fun applyPointerEvent(phase: Int, localX: Float, localY: Float, eventTimeMillis: Long) {
|
|
354
|
+
when (phase) {
|
|
355
|
+
0 -> onPointerDown(localX, localY, eventTimeMillis)
|
|
356
|
+
1 -> if (hasInput) onPointerMove(localX, localY, eventTimeMillis)
|
|
357
|
+
2 -> if (hasInput) onPointerUp(eventTimeMillis)
|
|
358
|
+
3 -> onPointerCancel()
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/** Gesture cancelled — identical to up except the velocity is dropped. */
|
|
363
|
+
public fun onPointerCancel() {
|
|
364
|
+
syncToNow()
|
|
365
|
+
pointerHeld = false
|
|
366
|
+
velocityTracker.reset()
|
|
367
|
+
state.velocityX = 0f
|
|
368
|
+
state.velocityY = 0f
|
|
369
|
+
pressTarget = 0f
|
|
370
|
+
opticalTarget = 0f
|
|
371
|
+
scaleTarget = 1f
|
|
372
|
+
pointerTargetX = 0f
|
|
373
|
+
pointerTargetY = 0f
|
|
374
|
+
pointerX.velocity = 0f
|
|
375
|
+
pointerY.velocity = 0f
|
|
376
|
+
retargetAll()
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/** True while the control is pressed or springing toward the pressed state. */
|
|
380
|
+
public val isPressEngaged: Boolean
|
|
381
|
+
get() = hasInput && pressTarget > 0.5f
|
|
382
|
+
|
|
383
|
+
/** Programmatic press for controls that animate without a pointer (a tap). */
|
|
384
|
+
public fun press() {
|
|
385
|
+
syncToNow()
|
|
386
|
+
if (hasInput && pressTarget == 1f && opticalTarget == 1f && scaleTarget == pressedScale) return
|
|
387
|
+
hasInput = true
|
|
388
|
+
pressTarget = 1f
|
|
389
|
+
opticalTarget = 1f
|
|
390
|
+
scaleTarget = pressedScale
|
|
391
|
+
retargetAll()
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
public fun release() {
|
|
395
|
+
syncToNow()
|
|
396
|
+
if (!hasInput && pressTarget == 0f && opticalTarget == 0f && scaleTarget == 1f) return
|
|
397
|
+
if (pressTarget == 0f && opticalTarget == 0f && scaleTarget == 1f && pointerTargetX == 0f && pointerTargetY == 0f) return
|
|
398
|
+
pressTarget = 0f
|
|
399
|
+
opticalTarget = 0f
|
|
400
|
+
scaleTarget = 1f
|
|
401
|
+
pointerTargetX = 0f
|
|
402
|
+
pointerTargetY = 0f
|
|
403
|
+
retargetAll()
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Retarget the value spring while a finger owns the control.
|
|
408
|
+
*
|
|
409
|
+
* The reference does not write the dragged value straight through: its `onDrag`
|
|
410
|
+
* updates a fraction and `updateValue` immediately calls `animateTo` with the
|
|
411
|
+
* value spring, so the lens trails the finger by a few frames. That is the
|
|
412
|
+
* behaviour the class is named for (`DampedDragAnimation`), and replicating it
|
|
413
|
+
* matters because a write-through lens reads as a raw input device rather than
|
|
414
|
+
* as a weighted object. The spring is fast (ratio 1.0, stiffness 1000) so the
|
|
415
|
+
* trail is short, and each retarget keeps its inherited velocity, which is what
|
|
416
|
+
* makes a rapid reversal feel continuous instead of restarting.
|
|
417
|
+
*/
|
|
418
|
+
public fun dragValueTravel(travel: Float, trackLength: Float) {
|
|
419
|
+
// Track smoothed normalized velocity across discrete drag packets.
|
|
420
|
+
animateValueTravel(travel, trackLength, velocity = 0f, isDrag = true)
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Set the lens travel and spring to it: a release, a tap, or a programmatic change.
|
|
425
|
+
*
|
|
426
|
+
* [velocity] is the finger's own value velocity at the moment of release, used to
|
|
427
|
+
* continue past the point it stopped. Pass 0 for a drag retarget.
|
|
428
|
+
*/
|
|
429
|
+
public fun animateValueTravel(
|
|
430
|
+
travel: Float,
|
|
431
|
+
trackLength: Float,
|
|
432
|
+
velocity: Float = 0f,
|
|
433
|
+
) {
|
|
434
|
+
animateValueTravel(travel, trackLength, velocity, isDrag = false)
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
private fun animateValueTravel(
|
|
438
|
+
travel: Float,
|
|
439
|
+
trackLength: Float,
|
|
440
|
+
velocity: Float,
|
|
441
|
+
isDrag: Boolean,
|
|
442
|
+
) {
|
|
443
|
+
syncToNow()
|
|
444
|
+
val now = clockNanos()
|
|
445
|
+
val previousTarget = valueTarget
|
|
446
|
+
this.trackLength = trackLength
|
|
447
|
+
val target = if (trackLength > 0f) (travel / trackLength).coerceIn(0f, 1f) else 0f
|
|
448
|
+
val arriving = kotlin.math.abs(target - valueTarget) < 1e-6f
|
|
449
|
+
valueTarget = target
|
|
450
|
+
if (isDrag) {
|
|
451
|
+
val dt = if (lastValueEventNanos >= 0L && now > lastValueEventNanos) {
|
|
452
|
+
((now - lastValueEventNanos) / 1e9f).coerceIn(1f / 120f, 0.08f)
|
|
453
|
+
} else {
|
|
454
|
+
0f
|
|
455
|
+
}
|
|
456
|
+
val nextVelocityTarget = if (dt > 0f && !arriving) {
|
|
457
|
+
((target - previousTarget) / dt).coerceIn(-25f, 25f)
|
|
458
|
+
} else {
|
|
459
|
+
0f
|
|
460
|
+
}
|
|
461
|
+
retargetDragVelocity(nextVelocityTarget, now)
|
|
462
|
+
lastValueEventNanos = now
|
|
463
|
+
} else {
|
|
464
|
+
lastValueEventNanos = -1L
|
|
465
|
+
if (velocity != 0f) {
|
|
466
|
+
valueVelocityStart = velocity
|
|
467
|
+
value.velocity = velocity
|
|
468
|
+
dragVelocity.value = velocity
|
|
469
|
+
dragVelocity.velocity = 0f
|
|
470
|
+
}
|
|
471
|
+
retargetDragVelocity(0f, now)
|
|
472
|
+
}
|
|
473
|
+
hasInput = true
|
|
474
|
+
val velocityMoving = kotlin.math.abs(dragVelocity.value - dragVelocityTarget) > GlassSprings.REST_THRESHOLD ||
|
|
475
|
+
kotlin.math.abs(dragVelocity.velocity) > GlassSprings.REST_THRESHOLD
|
|
476
|
+
if (arriving && !valueMoving() && !velocityMoving) {
|
|
477
|
+
publish()
|
|
478
|
+
return
|
|
479
|
+
}
|
|
480
|
+
retargetAll()
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
private fun retargetDragVelocity(target: Float, now: Long) {
|
|
484
|
+
dragVelocityStart = dragVelocity.value
|
|
485
|
+
dragVelocityVelocityStart = dragVelocity.velocity
|
|
486
|
+
dragVelocityTarget = target
|
|
487
|
+
dragVelocityStartedAtNanos = now
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
private fun valueMoving(): Boolean =
|
|
491
|
+
hasAnimation && kotlin.math.abs(value.value - valueTarget) > GlassSprings.REST_THRESHOLD
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Legacy entry point: sets the travel and lets the caller decide. Kept because
|
|
495
|
+
* surfaces driven from JS props (a controlled switch re-rendered by its parent)
|
|
496
|
+
* have no gesture of their own and simply publish the value they were given.
|
|
497
|
+
*/
|
|
498
|
+
public fun setValueTravel(travel: Float, trackLength: Float) {
|
|
499
|
+
if (valueTravel == travel && valueTarget ==
|
|
500
|
+
(if (trackLength > 0f) (travel / trackLength).coerceIn(0f, 1f) else 0f)
|
|
501
|
+
) return
|
|
502
|
+
animateValueTravel(travel, trackLength)
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/** Reduced-motion values retain the same material and geometry without springs. */
|
|
506
|
+
public fun snapValueTravel(travel: Float, trackLength: Float) {
|
|
507
|
+
stop()
|
|
508
|
+
hasInput = true
|
|
509
|
+
this.trackLength = trackLength
|
|
510
|
+
val fraction = if (trackLength > 0f) (travel / trackLength).coerceIn(0f, 1f) else 0f
|
|
511
|
+
value.value = fraction
|
|
512
|
+
value.velocity = 0f
|
|
513
|
+
valueTarget = fraction
|
|
514
|
+
valueStart = fraction
|
|
515
|
+
valueTravel = fraction * this.trackLength
|
|
516
|
+
press.value = 0f
|
|
517
|
+
press.velocity = 0f
|
|
518
|
+
pressTarget = 0f
|
|
519
|
+
optical.value = 0f
|
|
520
|
+
optical.velocity = 0f
|
|
521
|
+
opticalTarget = 0f
|
|
522
|
+
scaleX.value = 1f
|
|
523
|
+
scaleY.value = 1f
|
|
524
|
+
scaleX.velocity = 0f
|
|
525
|
+
scaleY.velocity = 0f
|
|
526
|
+
scaleTarget = 1f
|
|
527
|
+
dragVelocity.value = 0f
|
|
528
|
+
dragVelocity.velocity = 0f
|
|
529
|
+
dragVelocityTarget = 0f
|
|
530
|
+
dragVelocityStartedAtNanos = -1L
|
|
531
|
+
lastValueEventNanos = -1L
|
|
532
|
+
velocityTracker.reset()
|
|
533
|
+
state.velocityX = 0f
|
|
534
|
+
state.velocityY = 0f
|
|
535
|
+
state.isSettled = true
|
|
536
|
+
publish()
|
|
537
|
+
onFrame?.invoke()
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
private fun retargetAll() {
|
|
541
|
+
// A static surface has nothing to animate. Requesting frames for it would
|
|
542
|
+
// make every ornament on a page invalidate itself on every touch, which is
|
|
543
|
+
// exactly the kind of cost that makes a page feel heavy without looking any
|
|
544
|
+
// different.
|
|
545
|
+
if (kind == GlassInteractionKind.STATIC) {
|
|
546
|
+
hasAnimation = false
|
|
547
|
+
running = false
|
|
548
|
+
state.isSettled = true
|
|
549
|
+
return
|
|
550
|
+
}
|
|
551
|
+
val now = clockNanos()
|
|
552
|
+
// The caller has already synced to this instant, so the new targets take
|
|
553
|
+
// over from the position the user is actually looking at and inherit the
|
|
554
|
+
// velocity that was already moving.
|
|
555
|
+
captureCurrent(now)
|
|
556
|
+
startedAtNanos = now
|
|
557
|
+
hasAnimation = true
|
|
558
|
+
running = true
|
|
559
|
+
scheduleFrame()
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Advances the springs to the current instant under the *old* targets.
|
|
564
|
+
*
|
|
565
|
+
* Every input handler calls this before it writes a new target. Without it the
|
|
566
|
+
* subsequent capture mixes a fresh target with the previous segment's start
|
|
567
|
+
* values, and the spring evaluates a segment it never actually travelled —
|
|
568
|
+
* which is why an interrupting tap teleported the body to its full press size
|
|
569
|
+
* and a rapid sequence lost the press entirely.
|
|
570
|
+
*/
|
|
571
|
+
private fun syncToNow() {
|
|
572
|
+
val now = clockNanos()
|
|
573
|
+
if (!hasAnimation) return
|
|
574
|
+
if (now > startedAtNanos) advance(now)
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
private fun captureCurrent(nowNanos: Long) {
|
|
578
|
+
// The state is already current: syncToNow() ran before the targets moved.
|
|
579
|
+
valueStart = value.value
|
|
580
|
+
valueVelocityStart = value.velocity
|
|
581
|
+
pressStart = press.value
|
|
582
|
+
pressVelocityStart = press.velocity
|
|
583
|
+
scaleXStart = scaleX.value
|
|
584
|
+
scaleYStart = scaleY.value
|
|
585
|
+
scaleXVelocityStart = scaleX.velocity
|
|
586
|
+
scaleYVelocityStart = scaleY.velocity
|
|
587
|
+
pointerXStart = pointerX.value
|
|
588
|
+
pointerYStart = pointerY.value
|
|
589
|
+
pointerXVelocityStart = pointerX.velocity
|
|
590
|
+
pointerYVelocityStart = pointerY.velocity
|
|
591
|
+
opticalStart = optical.value
|
|
592
|
+
opticalVelocityStart = optical.velocity
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
private fun scheduleFrame() {
|
|
596
|
+
if (frameScheduled) return
|
|
597
|
+
frameScheduled = true
|
|
598
|
+
frameScheduler.schedule(frameCallback)
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/** Stops the callback without changing the current state. */
|
|
602
|
+
public fun stop() {
|
|
603
|
+
running = false
|
|
604
|
+
startedAtNanos = 0L
|
|
605
|
+
hasAnimation = false
|
|
606
|
+
if (frameScheduled) {
|
|
607
|
+
frameScheduler.cancel(frameCallback)
|
|
608
|
+
frameScheduled = false
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Advances every spring to [nowNanos] and returns true if any is still
|
|
614
|
+
* moving. One elapsed value per spring, all taken from the same clock.
|
|
615
|
+
*/
|
|
616
|
+
public fun advance(nowNanos: Long): Boolean {
|
|
617
|
+
if (!hasAnimation) return false
|
|
618
|
+
val elapsed = ((nowNanos - startedAtNanos).coerceAtLeast(0L) / 1e9f)
|
|
619
|
+
val valueMoving = valueSpec.evaluate(
|
|
620
|
+
valueStart - valueTarget,
|
|
621
|
+
valueVelocityStart,
|
|
622
|
+
elapsed,
|
|
623
|
+
evaluate,
|
|
624
|
+
evaluateVelocity,
|
|
625
|
+
)
|
|
626
|
+
value.value = valueTarget + evaluate[0]
|
|
627
|
+
value.velocity = evaluateVelocity[0]
|
|
628
|
+
|
|
629
|
+
val pressMoving = pressSpec.evaluate(
|
|
630
|
+
pressStart - pressTarget,
|
|
631
|
+
pressVelocityStart,
|
|
632
|
+
elapsed,
|
|
633
|
+
evaluate,
|
|
634
|
+
evaluateVelocity,
|
|
635
|
+
)
|
|
636
|
+
press.value = pressTarget + evaluate[0]
|
|
637
|
+
press.velocity = evaluateVelocity[0]
|
|
638
|
+
|
|
639
|
+
val scaleXMoving = scaleXSpec.evaluate(
|
|
640
|
+
scaleXStart - scaleTarget,
|
|
641
|
+
scaleXVelocityStart,
|
|
642
|
+
elapsed,
|
|
643
|
+
evaluate,
|
|
644
|
+
evaluateVelocity,
|
|
645
|
+
)
|
|
646
|
+
scaleX.value = scaleTarget + evaluate[0]
|
|
647
|
+
scaleX.velocity = evaluateVelocity[0]
|
|
648
|
+
|
|
649
|
+
val scaleYMoving = scaleYSpec.evaluate(
|
|
650
|
+
scaleYStart - scaleTarget,
|
|
651
|
+
scaleYVelocityStart,
|
|
652
|
+
elapsed,
|
|
653
|
+
evaluate,
|
|
654
|
+
evaluateVelocity,
|
|
655
|
+
)
|
|
656
|
+
scaleY.value = scaleTarget + evaluate[0]
|
|
657
|
+
scaleY.velocity = evaluateVelocity[0]
|
|
658
|
+
|
|
659
|
+
val pointerXMoving: Boolean
|
|
660
|
+
val pointerYMoving: Boolean
|
|
661
|
+
if (pointerHeld) {
|
|
662
|
+
// The finger is the authority on where the press is. There is nothing
|
|
663
|
+
// to spring toward, and pretending otherwise would move the body off
|
|
664
|
+
// the pointer it is supposed to be following.
|
|
665
|
+
pointerX.value = pointerTargetX
|
|
666
|
+
pointerY.value = pointerTargetY
|
|
667
|
+
pointerX.velocity = 0f
|
|
668
|
+
pointerY.velocity = 0f
|
|
669
|
+
pointerXMoving = false
|
|
670
|
+
pointerYMoving = false
|
|
671
|
+
} else {
|
|
672
|
+
pointerXMoving = pointerSpec.evaluate(
|
|
673
|
+
pointerXStart - pointerTargetX,
|
|
674
|
+
pointerXVelocityStart,
|
|
675
|
+
elapsed,
|
|
676
|
+
evaluate,
|
|
677
|
+
evaluateVelocity,
|
|
678
|
+
)
|
|
679
|
+
pointerX.value = pointerTargetX + evaluate[0]
|
|
680
|
+
pointerX.velocity = evaluateVelocity[0]
|
|
681
|
+
|
|
682
|
+
pointerYMoving = pointerSpec.evaluate(
|
|
683
|
+
pointerYStart - pointerTargetY,
|
|
684
|
+
pointerYVelocityStart,
|
|
685
|
+
elapsed,
|
|
686
|
+
evaluate,
|
|
687
|
+
evaluateVelocity,
|
|
688
|
+
)
|
|
689
|
+
pointerY.value = pointerTargetY + evaluate[0]
|
|
690
|
+
pointerY.velocity = evaluateVelocity[0]
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
val opticalMoving = opticalSpec.evaluate(
|
|
694
|
+
opticalStart - opticalTarget,
|
|
695
|
+
opticalVelocityStart,
|
|
696
|
+
elapsed,
|
|
697
|
+
evaluate,
|
|
698
|
+
evaluateVelocity,
|
|
699
|
+
)
|
|
700
|
+
optical.value = opticalTarget + evaluate[0]
|
|
701
|
+
optical.velocity = evaluateVelocity[0]
|
|
702
|
+
|
|
703
|
+
if (lastValueEventNanos >= 0L && dragVelocityTarget != 0f && nowNanos - lastValueEventNanos > 55_000_000L) {
|
|
704
|
+
retargetDragVelocity(0f, nowNanos)
|
|
705
|
+
}
|
|
706
|
+
val dragVelocityElapsed = if (dragVelocityStartedAtNanos >= 0L) {
|
|
707
|
+
((nowNanos - dragVelocityStartedAtNanos).coerceAtLeast(0L) / 1e9f)
|
|
708
|
+
} else {
|
|
709
|
+
elapsed
|
|
710
|
+
}
|
|
711
|
+
val dragVelocityMoving = velocitySpec.evaluate(
|
|
712
|
+
dragVelocityStart - dragVelocityTarget,
|
|
713
|
+
dragVelocityVelocityStart,
|
|
714
|
+
dragVelocityElapsed,
|
|
715
|
+
evaluate,
|
|
716
|
+
evaluateVelocity,
|
|
717
|
+
)
|
|
718
|
+
dragVelocity.value = dragVelocityTarget + evaluate[0]
|
|
719
|
+
dragVelocity.velocity = evaluateVelocity[0]
|
|
720
|
+
|
|
721
|
+
if (!valueMoving && !dragVelocityMoving && !pressMoving && !scaleXMoving && !scaleYMoving &&
|
|
722
|
+
!pointerXMoving && !pointerYMoving && !opticalMoving
|
|
723
|
+
) {
|
|
724
|
+
state.isSettled = true
|
|
725
|
+
startedAtNanos = 0L
|
|
726
|
+
dragVelocityStartedAtNanos = -1L
|
|
727
|
+
hasAnimation = false
|
|
728
|
+
publish()
|
|
729
|
+
return false
|
|
730
|
+
}
|
|
731
|
+
state.isSettled = false
|
|
732
|
+
publish()
|
|
733
|
+
return true
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/** Copies the springs into [state] and evaluates the layer transform. */
|
|
737
|
+
public fun publish() {
|
|
738
|
+
// Reference buttons feed the raw under-damped spring into their layer transform.
|
|
739
|
+
state.pressProgress = if (kind == GlassInteractionKind.BUTTON) {
|
|
740
|
+
press.value
|
|
741
|
+
} else {
|
|
742
|
+
press.value.coerceIn(0f, 1f)
|
|
743
|
+
}
|
|
744
|
+
state.scaleX = scaleX.value
|
|
745
|
+
state.scaleY = scaleY.value
|
|
746
|
+
state.pointerX = pointerX.value
|
|
747
|
+
state.pointerY = pointerY.value
|
|
748
|
+
state.opticalProgress = optical.value.coerceIn(0f, 1f)
|
|
749
|
+
// The travelling kinds position themselves from the value spring. Publishing
|
|
750
|
+
// the travel and the value's own velocity here keeps the lens geometry and the
|
|
751
|
+
// velocity shear that deforms it on the same clock — the reference reads both
|
|
752
|
+
// from one DampedDragAnimation for exactly this reason.
|
|
753
|
+
state.selectionProgress = value.value.coerceIn(0f, 1f)
|
|
754
|
+
|
|
755
|
+
if (kind == GlassInteractionKind.TOGGLE_KNOB ||
|
|
756
|
+
kind == GlassInteractionKind.SLIDER_KNOB ||
|
|
757
|
+
kind == GlassInteractionKind.TAB_LENS
|
|
758
|
+
) {
|
|
759
|
+
// InteractionDeformation divides normalized value velocity (fraction/s)
|
|
760
|
+
// by 50 (toggle) or 10 (slider/tab); multiplying by px trackLength or
|
|
761
|
+
// inverting sign saturated shear to +-0.2 and flipped X/Y axes mid-drag.
|
|
762
|
+
val activeVelocity = kotlin.math.max(
|
|
763
|
+
kotlin.math.abs(dragVelocity.value),
|
|
764
|
+
if (lastValueEventNanos < 0L) kotlin.math.abs(value.velocity) else 0f,
|
|
765
|
+
)
|
|
766
|
+
state.velocityX = activeVelocity
|
|
767
|
+
}
|
|
768
|
+
// The knob's sampled backdrop is a scaled copy of the track, not the scene.
|
|
769
|
+
// Publishing the scale here is what makes the thumb read as a detached bubble
|
|
770
|
+
// at rest and as a window into a magnified track while pressed. Derived from
|
|
771
|
+
// the same press spring that drives the silhouette, so the sample cannot widen
|
|
772
|
+
// while the shape stays put.
|
|
773
|
+
if (kind == GlassInteractionKind.TOGGLE_KNOB) {
|
|
774
|
+
val sample = InteractionDeformation.toggleTrackSampleScale(press.value)
|
|
775
|
+
state.trackSampleScaleX = sample.first
|
|
776
|
+
state.trackSampleScaleY = sample.second
|
|
777
|
+
} else if (kind == GlassInteractionKind.SLIDER_KNOB) {
|
|
778
|
+
val sample = InteractionDeformation.sliderTrackSampleScale(press.value)
|
|
779
|
+
state.trackSampleScaleX = sample.first
|
|
780
|
+
state.trackSampleScaleY = sample.second
|
|
781
|
+
}
|
|
782
|
+
evaluateTransform()
|
|
783
|
+
// The deformation's own translation is what the renderer moves the node by.
|
|
784
|
+
// Publishing it here is what makes the geometry and the optics one state:
|
|
785
|
+
// the shader reads the same pointer offsets and the same press progress that
|
|
786
|
+
// produced this translation.
|
|
787
|
+
state.translationX = transform.translationX
|
|
788
|
+
state.translationY = transform.translationY
|
|
789
|
+
state.deformationScaleX = transform.scaleX
|
|
790
|
+
state.deformationScaleY = transform.scaleY
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
private fun evaluateTransform() {
|
|
794
|
+
InteractionDeformation.apply(
|
|
795
|
+
state = state,
|
|
796
|
+
kind = kind,
|
|
797
|
+
width = width,
|
|
798
|
+
height = height,
|
|
799
|
+
density = density,
|
|
800
|
+
valueTravel = when (kind) {
|
|
801
|
+
GlassInteractionKind.BUTTON, GlassInteractionKind.STATIC -> valueTravel
|
|
802
|
+
// Reference `LiquidSlider` centres its knob on the value rather than
|
|
803
|
+
// insetting it from the start, so its offset is half a knob behind the
|
|
804
|
+
// value's own position.
|
|
805
|
+
GlassInteractionKind.SLIDER_KNOB -> value.value * trackLength - width / 2f
|
|
806
|
+
else -> value.value * trackLength
|
|
807
|
+
},
|
|
808
|
+
out = transform,
|
|
809
|
+
trackLength = trackLength,
|
|
810
|
+
)
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/** Snapshot of the springs for the deterministic trace tests. */
|
|
814
|
+
public fun snapshot(): String = buildString {
|
|
815
|
+
append("press=").append(press.value)
|
|
816
|
+
append(" scaleX=").append(scaleX.value)
|
|
817
|
+
append(" scaleY=").append(scaleY.value)
|
|
818
|
+
append(" pointerX=").append(pointerX.value)
|
|
819
|
+
append(" pointerY=").append(pointerY.value)
|
|
820
|
+
append(" optical=").append(optical.value)
|
|
821
|
+
append(" velocityX=").append(state.velocityX)
|
|
822
|
+
append(" velocityY=").append(state.velocityY)
|
|
823
|
+
}
|
|
824
|
+
}
|